I wonder is there any way to see the history of a region in git, i.e. all the commits that touched some pieces of code (defined as several contiguous lines of code)? I think this is kind of cool.
I am using magit, so any suggestions on how to use magit to achieve this goal would be even better.
A first simple solution is
git log -- file1 file2 dir1
: it will only show the commit which touched those files / directories.Another approach would be using
git gui blame <commit> file
Here each line of file will be annotated with the sha1 which introduced it, and you can click those sha1 to navigate among commits.