Thursday, June 6, 2013

More Git

1.
$ git log --oneline --decorate
4cf7a70 (HEAD, origin/next, origin/master, origin/HEAD, master) misc: fix gcc -Wall nits
fd9ca82 e2fsck: fix gcc -Wall nits
894eaf8 libext2fs: fix gcc -Wall nits
581ecb6 Merge branch 'maint' into next
6847735 (origin/maint) e2fsck: fix gcc -Wall nits


2.
git clone -b stable_1.2.0 ssh://username@my.git.repo.com:29418/e2fsprogs

3.
The name-rev command can tell us the position of a commit relative to tags in the project.
 
$ git name-rev --name-only 737da033
tags/2.2.51~30

$

This tells us that this commit is located 30 commits before “2.2.51” was tagged—we can be certain that this change is now part of 2.2.51, then.

4.
Find out which branch contains the change;
 
$ git branch --contains 5bdbd0e
* b_neo_stable_1.2.0

$

5.
See which changes from a branch are already present upstream

$ git cherry -v master
+ 244a9a58c06db1317360a6ec42a6344ff5cc73e6 initial work on AD support for lustre
+ b5e324519aacf6c0a7891783fd7b9e4dce710004 import xyratex patch
+ cb03cca8bbcd62541ce822e9be9099f2a7e947ef inital implementation of Windows AD integration
+ cd5ee7a2698d51dbc46a7b31586eee0a2d70de4d fix build without ldap
...


6.
Show last commit message that matches a regex

$ git show :/fix

Show the last commit which has "fix" in it.

7.
$ git log --follow -p file

This will show the entire history of the file (including history beyond renames and with diffs for each change)

Courtesy : [ git tips][stackoverflow] 

No comments: