User Tools

Site Tools


git:git_chectsheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
git:git_chectsheet [2011/08/01 10:20] devagit:git_chectsheet [2012/08/01 12:48] deva
Line 1: Line 1:
-====List current status (including changes) in repo====+======GIT CheatSheet====== 
 +=====List current status (including changes) in repo=====
 <code>git status</code> <code>git status</code>
  
Line 8: Line 9:
 <code>git ls-files -d</code> <code>git ls-files -d</code>
  
-====Undelete file====+=====Undelete file=====
 <code>git checkout filename</code> <code>git checkout filename</code>
  
Line 14: Line 15:
 <code>git ls-files -d | xargs git checkout --</code> <code>git ls-files -d | xargs git checkout --</code>
  
-====Mark conflict as resolved====+=====Mark conflict as resolved=====
 ''filename'' will have merge conflicts marked in the same way used in CVS. ''filename'' will have merge conflicts marked in the same way used in CVS.
 <code>git add filename</code> marks the conflict as resolved. <code>git add filename</code> marks the conflict as resolved.
 +
 +=====Turn off pager=====
 +<code>git --no-pager [command]</code>
 +Run <code>alias git='git --no-pager'</code> to disable it on all commands in the current shell.
 +Alternatively set ''core.pager = '' in .gitconfig (it is set to the empty string.) to disable it entirely for that user.
 +
 +=====Tags=====
 +====Create====
 +<code>
 +git tag -a v1.4 -m 'version 1.4'
 +</code>
 +
 +====List====
 +All:
 +<code>
 +git tag
 +</code>
 +Or filtered:
 +<code>
 +git tag -l v1.*
 +</code>
 +
 +====Show====
 +<code>
 +git show v1.4
 +</code>
 +
 +====Push====
 +By default, the ‘git push’ command will not transfer tags to remote servers. To do so, you have to explicitly add a –-tags to the ‘git push’ command.
 +
 +=====Branches=====
 +====List branches====
 +<code>
 +git branch
 +</code>
 +
 +====Switch to branch====
 +<code>
 +git checkout [branchname]
 +</code>
 +
 +
 +=====CVS 2 GIT=====
 +<code>
 +git cvsimport -k -i -d server:/path/to/CVSHOME -C git_reponame cvs_reponame
 +</code>
 +The resulting git_reponame directory now contains the .git folder which can be moved to a server location for shared access.
 +Run ''git update-server-info'' in the new server folder in order to make it shareable.
 +
 +=====Branching/Merging=====
 +From: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging