Git Cheat Sheet
by gracee via cheatography.com/80885/cs/19446/
Create git bisect
git clone Clone an existing repository git bisect start Begins the bisect process
git init Clone a local repository git bisect good/bad <ta‐ Marks <tag> as a broken or working
git add Add files to staging g> version
git commit Commit staged changes to the repository git bisect good/bad Marks the commit as good or bad
git commit --amend Reword the last commit message git bisect reset Ends the bisect process
git mv Move or rename a file
git log
git rm Unstage files
git reflog Displays an ordered list of the commits that HEAD has
pointed to
Branches
git log--<‐ Limit the number of commits displayed
git branch Lists all branches
limit>
git checkout <branch> Switches to a new branch
git log -- Limit each commit to a single line
git checkout -b <br‐ Creates the new branch while also
oneline
anch> switching to it
git log -- Shows the file(s) that have been modified, the number
git branch -d <branc‐ Deletes the branch
stat of lines that have been added or removed and also
h>
displays a summary line
git merge <branch> Merges current branch into <branch>
git log -- Search for a specific word/phrase in a list of commits
grep="<p‐
Update
attern>"
git remote -v List remotes git log -- Display all commits by an author
git remote add <path> Adds a new remote author="‐
git fetch Get the latest changes from origin <author>"
git pull Get the latest changes and merge git log -- Only show commits in a certain file
<file>
git push Publish local changes to the
repository git log -- Display a log with only merge commits
merges
git push <remote> :<bran‐ Deletes remote branch
ch> git Group commits by their authors
shortlog
git reset --hard HEAD Undo local commits
git diff View the difference between two commits
git rebase and cherry pick
git rebase <br‐ Takes the current branch's commits and applies
anch> them on top of another base
git rebase -i Changing commits in ways such as editing,
deleting or squashing
git rebase -- Staging files changes during interactive rebase
continue
git rebase -- Terminates the process
abort
git cherry-pick Choose commits from one branch and apply it
<commit> onto another
By gracee Published 23rd April, 2019. Sponsored by CrosswordCheats.com
cheatography.com/gracee/ Last updated 23rd April, 2019. Learn to solve cryptic crosswords!
Page 1 of 1. http://crosswordcheats.com