0% found this document useful (0 votes)
8 views

Cheatsheet Git

Uploaded by

Masude Khalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Cheatsheet Git

Uploaded by

Masude Khalid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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 <ta​g> 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
lim​it>
git checkout <br​anc​h> 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
anc​h> switching to it
git log -- Shows the file(s) that have been modified, the number
git branch -d <br​anc​‐ Deletes the branch
stat of lines that have been added or removed and also
h>
displays a summary line
git merge <br​anc​h> Merges current branch into <br​anc​h>
git log -- Search for a specific word/p​hrase in a list of commits
grep​="<p​‐
Update
att​ern​>"
git remote -v List remotes git log -- Display all commits by an author
git remote add <pa​th> Adds a new remote auth​or=​"​‐
git fetch Get the latest changes from origin <au​tho​r>"

git pull Get the latest changes and merge git log -- Only show commits in a certain file
<fi​le>
git push Publish local changes to the
repository git log -- Display a log with only merge commits
merges
git push <re​mot​e> :<b​ran​‐ 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
anc​h> 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 intera​ctive rebase
continue
git rebase -- Terminates the process
abort
git cherry​-pick Choose commits from one branch and apply it
<co​mmi​t> 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

You might also like