Git comprehensive cheat sheet
git init
git clone <repo-url>
git clone --depth 1 <repo-url>
git status
git add <file>
git add .
git commit -m "Commit message"
git branch <branch-name>
git switch <branch-name>
git merge <branch-name>
git merge --squash <branch-name>
git rebase -i <base-commit>
git cherry-pick <commit>
git bisect start
git bisect good <commit>
git bisect bad <commit>
git bisect reset
git submodule add <repo-url> <path>
git submodule update --init --recursive
git lfs track "*.psd"
git add .gitattributes
git format-patch -1 <commit>
git apply <patch-file>
echo ".env" >> .gitignore
echo "echo Hello" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
git config --global credential.helper cache
ssh-keygen -t ed25519 -C "[email protected]"
ssh-add ~/.ssh/id_ed25519
git log --oneline --graph --decorate
git diff <commit1> <commit2>
git commit --amend
git rebase <branch>
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global alias.co checkout