Git - Random stuff you can do with it
View number of commits per author:
git shortlog -s -n
(cant remember where i got this pic from)
Pretty git log:
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
Taken from: https://coderwall.com/p/euwpig
Search for commits that touches a particular line:
git log -S'todo'
Search for changes that is happening in a file:
git blame /pathto/file
Figure out which commit is causing problems on the site. Useful for rolling back commits:
- Find out last known good commit, eg: fd12345
- $ git bisect start
- $ git bisect bad 4 $ git bisect good fd12345 5 follow instructions on screen to mark commits as either good or bad. Git would in the end tell you which commit is bad.
Note: git is basically doing a binary search to figure out which commit is the bad commit
finish up by typing: $ git bisect reset
Written by Victor Liew
Related protips
2 Responses
This should be called, 'Random things you can do with Git', as none of it is essential. See http://rogerdudler.github.io/git-guide/ for git essentials....
over 1 year ago
·
agreed. i ended up not curating it properly as coderwall just keeps crashing on me =/
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#