I will summarize tips that I learned after reading a Git book.
Show the most recent tag that is reachable from a commit
For example, we know a commit hash that a bug was fixed. And we can find fixed version base on the commit hash.
$ git show c3957eea94cc170a404bdd47a7f43be1d0b07bca commit c3957eea94cc170a404bdd47a7f43be1d0b07bca Author: Arun Agrawal <email@example.com> Date: Fri Jul 15 18:22:09 2016 +0530 Merge pull request #25845 from znz/fix-broken-link Fix broken link [ci skip]
Which version is fixed?
$ git describe c3957eea94cc170a404bdd47a7f43be1d0b07bca v5.0.0-116-gc3957ee
v5.0.0 is the most recent tag that is reachable from a commit. So, it must be fixed on the next version v188.8.131.52.
Understand branches graphically
Use this command.
$ gitk --all
Check logs between remote master and local master
Check logs from remote origin master branch and local master branch
$ git log origin/master..master
Find the log that "String" was changed from logs
$ git log -p -S"String"
pull and rebase
Fetch origin/master, and do "rebase" of own modification based on it.
$ git pull --rebase
Find a commit hash that cases a bug.
$ git bisect start
After testing for each commit hash such as running test script, and judge for that.
$ git bisect good v1.6.0 $ git bisect bad v1.6.2 $ git bisect bad $ git bisect good ...
$ git bisect reset