Print lines matching a pattern.
Reference: https://git-scm.com/docs/git-grep
git grep -n "foo"
-n
, --line-number
show line numbers
Reference: https://www.atlassian.com/git/tutorials/git-log
Draw a text-based graphical representation of the commit history on the left hand side of the output.
git log --graph
Commonly combined with --oneline
.
master..feature
range contains all of the commits that are in the feature
branch, but aren’t in the master
branch.
In other words, how far feature
has progressed since it forked off of master
.
git log master..feature
Switching the order of the range (feature..master
), shows all of the commits in master
, but not in feature
.
git log `feature..master`
If git log
outputs commits for both versions, then this means the history has diverged.
Show all commit with log messages matching a given pattern:
git log --grep="message"
Show all commits related to a particular file:
git log -- foo.py
Show all commits that introduced a particular string:
git log -S "Hello World"
Show all commits that introduced a particular pattern:
git log -G "Hello [0-9]+"
Reference: https://git-scm.com/docs/git-notes
Add additional meta-data to commits without changing the commit object.
Use binary search to find the commit that introduced a bug.
References:
Find common ancestors.
Reference: https://git-scm.com/docs/git-merge-base
Find the point at which a branch forked from another branch.
git merge-base --fork-point master branch
Git web interface (web frontend to Git repositories).
References::
git instaweb --httpd=webrick