User Tools

Site Tools


quickref:git

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
quickref:git [2013/08/20 07:48]
andy [Pushing]
quickref:git [2013/10/30 12:13]
andy [Revision Ranges]
Line 8: Line 8:
  
 If you're not already moderately familiar with Git, strongly consider browsing the [[#Git Structure]] section first as it can make Git operations easier to understand. If you're not already moderately familiar with Git, strongly consider browsing the [[#Git Structure]] section first as it can make Git operations easier to understand.
 +
 +If you're just looking for some handy commands, check out the [[#​Recipes]] section.
  
  
Line 916: Line 918:
  
 Commands such as ''​git log''​ operate on a set of commits, not just a single one. To that end, the syntax for [[#single revisions]] is augmented in various ways to allow the specification of a range of commits: Commands such as ''​git log''​ operate on a set of commits, not just a single one. To that end, the syntax for [[#single revisions]] is augmented in various ways to allow the specification of a range of commits:
 +
 +<​note>​The syntax used by ''​git diff''​ appears superficially similar but is //not// the same!</​note>​
  
 ^ Method ^ Example ^ Explanation ^ ^ Method ^ Example ^ Explanation ^
Line 2093: Line 2097:
 </​file>​ </​file>​
  
 +===== Recipes =====
  
 +The following are some handy pre-canned commands for specific situations. You can set up [[https://​git.wiki.kernel.org/​index.php/​Aliases|aliases]] for these as well.
 +
 +==== Log ====
 +
 +Show recent commits with relative dates and authors:
 +
 +<​code>​
 +git log --pretty=format:"​%C(yellow)%h %C(cyan)%ad%C(yellow)%C(bold)%d %Creset%s%Cgreen [%cn]"​\
 +        --decorate --date=relative
 +</​code>​
 +
 +Show the history of a specified file:
 +
 +<​code>​
 +git log -u -- <​filename>​
 +</​code>​
 +
 +Show the state of all branches and how they relate:
 +
 +<​code>​
 +git log --all --graph --oneline --decorate --simplify-by-decoration
 +</​code>​
quickref/git.txt ยท Last modified: 2015/07/02 11:36 by andy