Git

Imagemap
GitGetting StartedIdentitygit config --global user.email geekw@fox ...git config --global user.name “TooLazyTo ...Editgit config --global core.editor emacschecking your settingsgit config --listgit config user.nameHelpgit help <verb>git help configgit  <verb>  --help man git-<verb>Git BasicsGetting a Git Repositorygit initgit clonegit clone https://github.com/toolazytona ...git clone https://github.com/toolazytona ...Recording Changes to the Repositorygit statusgit status -sgit add READMEcat .gitignoregit diffgit diff --stagedgit diff --cachedstaged 和 cached 是同义词 git difftool --tool-helpgit commitgit commit -m “toolazytoname message”git commit -a -m “toolazytoname跳过使用暂存区域”git rmgit rm -fadd it to the index alreadygit rm --cached READMEkeep the file in working tree but remove ...keep the file on your hard drive but no  ...git rm log/\*.loggit rm \*~\* is necessary  because Git dose its ow ...git mv file_from file_togit mv README.md README  相当于mv README.md READMEgit rm README.mdgit add READMEgit loggit log -p -2git log --statgit log  --pretty=onelinegit log --onelinegit log --pretty=format:"%h - %an, %ar : ...TABLE 2-1. Useful options for git log -- ...git log --pretty=format:"%h  %s" --graphTABLE 2-2. Common options to git log     ...Limiting Log Outputgit log --since=2.weeksgit log -StoolazytonameEditContentTABLE 2-3. Options to limit the output o ...git log -- author=“john”git log --author="\(Adam\)\|\(Jon\)"git log --author='^(?!Adam|Jon).*$' --pe ...git log --format='%H %an' |    grep -v A ...Undoing Things--amendgit commit -m ‘initial commit’ git add f ...git reset HEAD toolazytoname.md--hardgit checkout -- toolazytoname.mdUnstaging a Staged Filegit reset HEAD CONTRIBUTING.mdUnmodifying a Modified Filegit checkout —CONTRIBUTING.mdWorking with Remotesgit remotegit remote -vshows you the URLs that Git has stored f ...git remote add lazy https://github.com/t ...git remote show [temote-name]git remote show origingit remote rename toolazy lazy git remote  rm too lazygit fetch [remote-name]git fetch lazygit push origin master TaggingListing Your Tagsgit taggit tag -l ‘v1.8.5*’Creating TagsAnnotated Tagsgit tag -a v1.4 -m “lazy my version 1.4”git show v1.4Lightweight Tagsgit tag v1.4 -lwTagging Latergit tag -a v1.4 9fasdfSharing Tagsgit push origin v1.5git push origin --tagsChecking out Tagsgit checkout -b version2 v2.0.0deletegit tag -d tagNameToDeleteGit Aliasesgit config —global alias.co checkoutgit config --global alias.visual "!gitk"Git ToolsRevision SelectionShort SHA-1git loggit show a536c213ade98da8b24fe8177e04dd0 ...git log --abbrev-commit —pretty=onelineBranch Referencesgit show a5989fbfe21b3df02129d506563f708 ...git show mastergit rev-parse master a5989fbfe21b3df0212 ...RefLog Shortnamesgit refloga log of where your HEAD and branch refe ...git show HEAD@{5}git show master@{yesterday}git log -g master试了这是一个神奇的命令,就算reset --hard以后,也能找回来Ancestry Referencesgit show HEAD^the parent of HEADgit show a5989fb^git show a5989fb^2the second parent of a5989fbThis syntax is only useful for merge com ...git show HEAD~the first parentgit show HEAD~3the first parent of the first parentgit show HEAD^^^Commit RangesDOUBLE DOTgit log master..experimentD   Cin your experiment branch that hasn’t ye ...all commits reachable by experiment that ...git log experiment..masterF       Egit log origin/master..HEADgit log origin/master..MULTIPLE POINTSgit log refA..refBgit log ^refA refBgit log refB --not refAgit log refA refB ^refCgit log refA refB --not refCTRIPLE DOTgit log master…experimentF    E     D   Cspecifies all the commits that are reach ...--left --rightgit log --left-right master…experiment< F    < E     > D   > CInteractive Staginggit add iStashing and CleaningStashing Your Workgit stash git stash savegit stash listgit stash applygit stash apply --indexgit stash drop stash@{0}git stash popCreative Stashinggit stash --keep-indexnot stash anything that you’ve already s ...git stash --include-untrackedgit stash -ustash the untracked files as well as the ...git stash --patchGit will not stash everything that is mo ...Creating a Branch from a Stashgit stash branch testChangesCleaning your Working Directorygit clean新建节点git stash --allgit clean -f -dgit clean -ndo a dry run and tell me what you would  ...git clean -xremove those files that match a pattern  ...git clean -x -iinteractive modesigning Your WorkGPG Introductiongpg --listkeysgig --gen-keygit config - - global user.signingkey 0A ...Signing Tagsgit tag -s v1.5 -m “my signed 1.5 tag”git show v1.5Verifying Tagsgit tag -v v1.4.2.1this command uses GPG to verify the sign ...Signing Commitsgit commit -a -S -m ‘signed commit’git log - -show-signature -1SearchingGit Grepgit grep -n gmtime_rpass -n to print out the line numbers wh ...git grep --count gmtime_rhow many matches there were in each file ...git grep -p gmtime_r  *.cwant to see what method of function it t ...$ git grep --break --heading \
-n -e '#d ...git Log Searchinggit log -SZLIB_BUF_MAX --oneline-G regular expressionLINE LOG Searchshow you the history of a function or li ...git log -L :loadView:PlayerMoreControlle ...':funcname:file'git log -L '/- (void)loadView {/',/^}/:P ... 'start,end:file'Rewrite Historyall before you share your work with othe ...Changing the Last Commit git commit --amendChanging Multiple Commit Messagesgit rebase -i HEAD~3Reordering CommitsSquashing CommitsSplitting a CommitThe Nuclear Option:filter-branchREMOVING A FILE FROM EVERY COMMITgit filter-branch - - tree-filter ‘rm -f ...git filter-branch --tree-filter 'rm -f * ...--allMAKING A SUBDIRECTORY THE NEW ROOTgit filter-branch --subdirectory-filter  ...CHANGING EMAIL ADDRESSES GLOBALLYgit filter-branch --commit-filter '
if [ ...Reset DemystifiedThe Three TreesTHE HEADgit cat-file -p HEADgit ls-tree -r HEADTHE INDEXgit ls-files -sTHE WORKING DIRECTORYtreebrew instal treeThe WorkflowAdvanced Merginggit merge --abortgit merge -Xignore-space-change masterRerereDebugging with GitSubmodulesBundingReplaceCredential StorageGit BranchingBranches in NutshellCreating a New Branchgit branch testingSwitching Branchesgit checkout testingThis moves HEAD to point to the testing  ...git log  --oneline  --decorate --graph - ...--decorate  -- print out ref names of an ...Basic Branching and Merginggit checkout -b lazyBranchThis is shorthand forgit branch lazyBranchgit checkout lazyBranchgit branch -d lazyBranchgit mergetoolBranch Managementgit branch -vTo see the last commit on each branchgit branch --mergedfilter the list to branches that you hav ...git branch  --no-mergedBranching WorkflowsLong-Running BranchesTopic BranchesRemote BranchesPushinggit push (remote) (branch)git push origin serfixgit fetch originTracking Branchesgit checkout -b serverfix origin/serverf ...=git checkout --track origin/serverfixa different name than the remote namegit checkout -b sf origin/serverfixgit branch -u origin/serverfixor--set-upstream-togit branch -vvwant to see what tracking branches  you  ...Deleting Remotes Branchesgit push origin --delete serverfixRebasingThe Basic Rebasegit checkout experimentgit rebase mastergit checkout mastergit merge experimentMore interesting Rebasesgit rebase --onto master server clientgit checkout mastergit merge clientgit rebase master servergit rebase [basebranch] [topicbranch]git checkout master git merge servergit branch -d clientgit branch -d serverThe Perils of RebasingDo not rebase commits that exist outside ...git pull —rebasegit fetchgit rebase teamone/master
hide
Git
hide
Git Basics
hide
git log
hide
Git Branching
hide
Branches in Nutshell
hide
Rebasing
hide
The Basic Rebase
leaf
hide
More interesting Rebases
hide
Git Tools
hide
Revision Selection