diff --git a/docs/guides/git.md b/docs/guides/git.md index febabbe..a046825 100644 --- a/docs/guides/git.md +++ b/docs/guides/git.md @@ -1,8 +1,134 @@ -# GIT - -### What is git -### Commands +# Git -#### git clone -##### Clone a Repo (remote -> local) \ No newline at end of file +--- + +## Clone a repository +Copy an existing remote repository to your local machine. + +```bash +git clone +``` +Example: +```bash +git clone https://github.com/user/repo.git +``` + +--- + +## Pull changes from remote +Fetch and merge changes from a remote repository to your local branch. + +```bash +git pull +``` +Example: +```bash +git pull origin main +``` + +--- + +## Push changes to remote +Upload local commits to a remote repository. + +```bash +git push +``` +Example: +```bash +git push origin main +``` + +--- + +## Rebase branches +Reapply commits on top of another base tip. + +```bash +git rebase +``` +Example: +```bash +git rebase main +``` + +--- + +## Initialize a new repository +Create a new Git repository in the current directory. + +```bash +git init +``` + +--- + +## Manage remotes + +- **Add a remote:** +```bash +git remote add +``` + +- **Set/Update remote URL:** +```bash +git remote set-url +``` + +- **Remove a remote (e.g., origin):** +```bash +git remote remove origin +``` + +--- + +## Commit changes with GPG signature +Sign your commit with a GPG key. + +```bash +git commit -S -m "Your commit message" +``` +- `-S` → sign commit with GPG key +- `-m` → commit message + +--- + +## Notes +- Always ensure your branch is up-to-date before pushing: +```bash +git pull --rebase +``` +- Configure your GPG key once globally for signed commits: +```bash +git config --global user.signingkey +git config --global commit.gpgSign true +``` +- To check the configured remotes: +```bash +git remote -v +``` +- To see commit history: +```bash +git log --oneline --graph --all --decorate +``` +- Stage changes before committing: +```bash +git add +git add . # stage all changes +``` + +--- + +## Example Workflow + +```bash +git clone https://github.com/user/repo.git +cd repo +git checkout -b feature-branch +# make changes +git add . +git commit -S -m "Add new feature" +git pull --rebase origin main +git push origin feature-branch +``` diff --git a/mkdocs.yml b/mkdocs.yml index ddf5cd7..eb7e4cb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,7 +6,7 @@ theme: name: material palette: - # Light mode + # Light mode purple - scheme: default toggle: icon: material/brightness-7 @@ -14,6 +14,7 @@ theme: primary: purple accent: purple + # Light mode blue - scheme: default toggle: icon: material/numeric-1-box @@ -21,7 +22,7 @@ theme: primary: blue accent: blue - # Dark mode + # Dark mode purple - scheme: slate toggle: icon: material/brightness-4 @@ -29,6 +30,7 @@ theme: primary: purple accent: purple + # Dark mode blue - scheme: slate toggle: icon: material/numeric-1-box