Written by: Geoffrey Callaghan
comprensive git cheatsheet
Comprensive Git Cheatsheet
Sure! Here is a comprehensive Git cheatsheet that covers essential commands and concepts:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --list
git init
git clone [url]
git status
git add [file]
or git add .
(all files)git commit -m "commit message"
git commit --amend
git diff
git diff --staged
git log
git log --oneline
git show [commit]
git branch
git branch [branch-name]
git checkout [branch-name]
git checkout -b [branch-name]
git branch -d [branch-name]
git branch -m [new-name]
git merge [branch-name]
git merge --abort
git rebase [branch-name]
git rebase --continue
git rebase --abort
git remote add [name] [url]
git remote remove [name]
git remote -v
git push [remote] [branch]
git push --all [remote]
git pull [remote] [branch]
git fetch [remote]
git stash
git stash list
git stash apply [stash]
git stash pop
git stash drop [stash]
git reset [file]
git reset --hard
git reset --hard [commit]
git reset --soft [commit]
git reset --mixed [commit]
git revert [commit]
git log
git show [commit]
git diff [commit1] [commit2]
git diff [commit] [file]
git status
git tag [tag-name]
git tag -a [tag-name] -m "message"
git tag
git push [remote] [tag-name]
git cherry-pick [commit]
git submodule add [url] [path]
git submodule update --init --recursive
git clean -f
git clean -fd
git config --global alias.co checkout
git config --get-regexp alias
Initialize and configure Git:
git init
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Create a branch and switch to it:
git checkout -b new-feature
Stage and commit changes:
git add .
git commit -m "Add new feature"
Push changes to remote:
git push origin new-feature
Merge branch into main:
git checkout main
git merge new-feature
Push changes to remote main:
git push origin main
This cheatsheet covers the essential Git commands and workflows. Keep it handy as a quick reference guide while working with Git.