Git Cheat Sheet

HOME

git config --global user.name "<Your-Full-Name>"
git config --global user.email "<your-email-address>"

git init
git clone <repository_url>
git clone --branch <branch_name> <repo_url>

git status
git add <file1> <file2> … <fileN>
git add .
git rm <filename_or_dir>
 git diff [file]
git commit -m “[Commit message]”
git commit --amend -m "New commit message"

git branch
git branch -a
git branch [branch-name]
 git rebase [branch_name]
git checkout  [branch_name]
git checkout -b  [branch_name]
git switch -c  [branch_name]
git branch -d [branch_name]
git branch -D [branch_name]
git branch -m [branch_name]
git merge [branch_name]

git fetch [remote]
git push origin branch
git pull
git pull --rebase
git push --all
git remote
git remote add [name] [url]
git remote rm [remote]
git remote rename [old_name] [new_name]

git stash
git stash list
git stash pop
git stash drop

git log
git log --all
git diff
git log --author="Name"
git log --until="2024-12-31"
git log [file]
git show

Leave a comment