You are on page 1of 2

GIT CHEAT SHEET

MAKE CHANGES
Review edits and craf a commit transaction
! #$% &%'%(&
Lists all new or modied les to be commited
! #$% ')) *+$,-.
Snapshots the le in preparation for versioning
! #$% /-&-% *+$,-.
Unstages the le, but preserve its contents
! #$% )$++
Shows le dierences not yet staged
! #$% )$++ 00&%'#-)
Shows le dierences between staging and the last le version
! #$% 1233$% 03 4*)-&1/$5%$6- 3-&&'#-.4
Records le snapshots permanently in version history
CONFIGURE TOOLING
Congure user information for all local repositories
! #$% 127+$# 00#,28', (&-/97'3- 4*7'3-.4
Sets the name you want atached to your commit transactions
! #$% 127+$# 00#,28', (&-/9-3'$, 4*-3'$, '))/-&&.4
Sets the email you want atached to your commit transactions
! #$% 127+$# 00#,28', 12,2/9($ '(%2
Enables helpful colorization of command line output
CREATE REPOSITORIES
Start a new repository or obtain one from an existing URL
! #$% $7$% *5/2:-1%07'3-.
Creates a new local repository with the specied name
! #$% 1,27- *(/,.
Downloads a project and its entire version history
GROUP CHANGES
Name a series of commits and combine completed eorts
! #$% 8/'71;
Lists all local branches in the current repository
! #$% 8/'71; *8/'71;07'3-.
Creates a new branch
! #$% 1;-1<2(% *8/'71;07'3-.
Switches to the specied branch and updates the working directory
! #$% 3-/#- *8/'71;.
Combines the specied branchs history into the current branch
! #$% 8/'71; 0) *8/'71;07'3-.
Deletes the specied branch
Git is the open source distributed version control system that facilitates GitHub activities on your laptop or
desktop. This cheat sheet summarizes commonly used Git command line instructions for quick reference.
INSTALL GIT
GitHub provides desktop clients that include a graphical user
interface for the most common repository actions and an automati-
cally updating command line edition of Git for advanced scenarios.
GitHub for Windows
htps://windows.github.com
GitHub for Mac
htps://mac.github.com
Git distributions for Linux and POSIX systems are available on the
ocial Git SCM web site.
Git for All Platforms
htp://git-scm.com
V 1.1.1
training@github.com
training.github.com
Learn more about using GitHub and Git. Email the Training Team or visit
our web site for learning event schedules and private class availability.
GIT CHEAT SHEET
SYNCHRONIZE CHANGES
Register a repository bookmark and exchange version history
! #$% +-%1; *822<3'/<.
Downloads all history from the repository bookmark
! #$% 3-/#- *822<3'/<.=*8/'71;.
Combines bookmarks branch into current local branch
! #$% 5(&; *',$'&. *8/'71;.
Uploads all local branch commits to GitHub
! #$% 5(,,
Downloads bookmark history and incorporates changes
REFACTOR FILENAMES
Relocate and remove versioned les
! #$% /3 *+$,-.
Deletes the le from the working directory and stages the deletion
! #$% /3 001'1;-) *+$,-.
Removes the le from version control but preserves the le locally
! #$% 36 *+$,-02/$#$7',. *+$,-0/-7'3-).
Changes the le name and prepares it for commit
SAVE FRAGMENTS
Shelve and restore incomplete changes
! #$% &%'&;
Temporarily stores all modied tracked les
! #$% &%'&; ,$&%
Lists all stashed changesets
! #$% &%'&; 525
Restores the most recently stashed les
! #$% &%'&; )/25
Discards the most recently stashed changeset
REDO COMMITS
Erase mistakes and craf replacement history
! #$% /-&-% *1233$%.
Undoes all commits afer !"#$$%&', preserving changes locally
! #$% /-&-% 00;'/) *1233$%.
Discards all history and changes back to the specied commit
REVIEW HISTORY
Browse and inspect the evolution of project les
! #$% ,2#
Lists version history for the current branch
! #$% ,2# 00+2,,2> *+$,-.
Lists version history for a le, including renames
! #$% )$++ *+$/&%08/'71;.999*&-127)08/'71;.
Shows content dierences between two branches
! #$% &;2> *1233$%.
Outputs metadata and content changes of the specied commit
SUPPRESS TRACKING
Exclude temporary les and paths
! #$% ,&0+$,-& 002%;-/ 00$#72/-) 00-?1,()-0&%'7)'/)
Lists all ignored les in this project
@9,2#
8($,)=
%-350@
A text le named ()%&%)*#+, suppresses accidental versioning of
les and paths matching the specied paterns