Вы находитесь на странице: 1из 2

GIT CHEAT SHEET

V 1.1.0

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 automatically updating command line edition of Git for advanced scenarios. GitHub for Windows https://windows.github.com GitHub for Mac https://mac.github.com Git distributions for Linux and POSIX systems are available on the ocial Git SCM web site. Git for All Platforms http://git-scm.com

MAKE CHANGES
!"#$%#&#'%

Review edits and craft a commit transaction

List all new or modied les to be committed


!"#$("**

Show le dierences not yet staged


!"#$&(($)*"+,-

Snapshot the le in preparation for versioning


!"#$("**$//%#&!,(

Show le dierences between staging and the last le version


!"#$.,%,#$)*"+,-

Unstage the le, but preserve its contents

CONFIGURE TOOLING

!"#$0122"#$/2$3)(,%0."4#"5,$2,%%&!,-3

Congure user information for all local repositories


!"#$016*"!$//!+17&+$'%,.86&2,$3)6&2,-3

Record le snapshots permanently in version history

Set the name you want attached to your commit transactions


!"#$016*"!$//!+17&+$'%,.8,2&"+$3),2&"+$&((.,%%-3

GROUP CHANGES
!"#$7.&60:

Name a series of commits and combine completed eorts

Set the email you want attached to your commit transactions


!"#$016*"!$//!+17&+$01+1.8'"$&'#1

Enable helpful colorization of command line output

List all local branches in the current repository


!"#$7.&60:$)7.&60:/6&2,-

Create a new branch

CREATE REPOSITORIES

!"#$0:,0;1'#$)7.&60:/6&2,-

Start a new repository or obtain one from an existing URL


!"#$"6"#$)4.19,0#/6&2,-

Switch to the specied branch and update working directory


!"#$2,.!,$)7.&60:-

Create a new local repository with the specied name


!"#$0+16,$)'.+-

Combine the specied branchs history into the current branch


!"#$7.&60:$/($)7.&60:/6&2,-

Download a project and its entire version history

Delete the specied branch

GIT CHEAT SHEET

REFACTOR FILENAMES
!"#$.2$)*"+,-

Relocate and remove versioned les

REVIEW HISTORY
!"#$+1!

Browse and inspect the evolution of project les

Delete the le from the working directory and stage the deletion
!"#$.2$//0&0:,($)*"+,-

List version history for the current branch


!"#$+1!$//*1++1=$)*"+,-

Remove from version control but preserve the le locally


!"#$25$)*"+,/1."!"6&+-$)*"+,/.,6&2,(-

List version history for a le, including renames


!"#$("**$)*".%#/7.&60:-888)%,016(/7.&60:-

Change the lename and prepare it for commit

Show content dierences between two branches


!"#$%:1=$)0122"#-

SUPRESS TRACKING
?8+1! 7'"+(< #,24/?

Output metadata and content changes of the specied commit

Exclude temporary les and paths

REDO COMMITS

Erase mistakes and craft replacement history


!"#$.,%,#$)0122"#-

A text le named ()%&%)*#+, suppresses accidental versioning of les and paths matching the specied patterns
!"#$+%/*"+,%$//1#:,.$//"!61.,($//,>0+'(,/%#&6(&.(

Undo all commits after !"#$$%&', preserving changes locally


!"#$.,%,#$//:&.($)0122"#-

List all ignored les in this project

Discard all history and changes back to the specied commit

SAVE FRAGMENTS
!"#$%#&%:

Shelve and restore incomplete changes

SYNCHRONIZE CHANGES
!"#$*,#0:$)711;2&.;-

Register a repository bookmark and exchange version history

Temporarily store all modied tracked les


!"#$%#&%:$414

Download all history from the repository bookmark


!"#$2,.!,$)711;2&.;-<)7.&60:-

Restore the most recently stashed les


!"#$%#&%:$+"%#

Combine bookmarks branch into into current local branch


!"#$4'%:$)&+"&%-$)7.&60:-

List all stashed changesets


!"#$%#&%:$(.14

Upload all local branch commits to GitHub


!"#$4'++

Discard the most recently stashed changeset

Synchronize bookmark history and incorporate current branch

Learn more about using GitHub and Git. Email the Training Team or visit our web site for learning event schedules and private class availability.

training@github.com training.github.com

Вам также может понравиться