Show branches and tags in log

git log –oneline –decorate

Even better - all branches with graph

git log –oneline –decorate –all –graph

Highlight words instead of lines

git diff –word-diff HEAD~~~ HEAD~~

Also works in git log -p and git show

Better status

git status -sb

Compare with gs == git status

Find a name

➜  simstore-atg git:(master) ✗ git name-rev 2643908
2643908 remotes/origin/HEAD~2
 
 
➜  simstore-atg git:(master) ✗ git name-rev --name-only 2643908
remotes/origin/HEAD~2
 
 
➜  simstore-atg git:(master) ✗ git name-rev --name-only 188fcd6
LIVE
 
 
➜  simstore-atg git:(master) ✗ git name-rev --name-only 73c762c
remotes/origin/2013-10-22-LIVE~3

Find which branch has a commit

➜  simstore-atg git:(master) ✗ git branch --contains 73c762c
  LIVE
  LIVE-140430
  LIVE2
  LIVE3
  LIVE4
  PATCH-ORS-140605
  PATCH-ORS-140616
  feature_us_shipping
* master
 
 
➜  simstore-atg git:(master) ✗ git branch --contains 188fcd6
  LIVE
 
 
➜  simstore-atg git:(master) ✗ git branch --contains 2643908
 
 
➜  simstore-atg git:(master) ✗ git pull
Updating ed81557..220a6a7
Fast-forward
....
  
➜  simstore-atg git:(master) ✗ git branch --contains 2643908
* master

The NO RESULT from 2643908 was caused by the fact that this commit was present only in origin/master, not yet merged into local master. After pull, it does show

Of course, I could have used ‘-a’ flag to show all branches

➜  simstore-atg git:(master) ✗ git branch -a --contains 2643908
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Show which commit contains message

git show :/SIMWEB-700

For multiple commits: all commits related to ticket (searches THE COMMIT MESSAGE)

git last --grep SIMWEB-867
  
➜  simstore-atg git:(master) ✗ git last<TAB>
last      -- alias for 'log --pretty=format:"%h %ad | %s%d [%an]" --date=short'

Searches the DIFF - not the message - for SimpleDateFormat

git log –word-diff –stat -GSimpleDateFormat

The word SimpleDateFormat is NOT in message, but in diff:

If we inspect the commit diff for one of the commits:

➜  simstore-atg git:(master) ✗ git log -1 -p 2fc121c7e75c6f5aeb57b25030e5fa9896e29a88 | grep -n SimpleDateFormat
200:-import java.text.SimpleDateFormat;
279:-        SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
307:+import java.text.SimpleDateFormat;
405:+        SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
➜  simstore-atg git:(master) ✗