david@xxxxxxx writes: > I have a need to setup a repository where I'm storing config files, > and I need to be able to search the history of a particular line, not > just when the last edit of the line was (which is what I see from git > blame) > > I'm not seeing a obvious way to do this, am I missing something or > does it need a non-obvious approach? > > for example, if I do > > git blame -L /SUBLEVEL/,+1 -M Makefile > > on the linux kernel it currently shows > > 57f8f7b6 (Linus Torvalds 2008-10-23 20:06:52 -0700 3) SUBLEVEL = 28 > > what I would want it to show would be a list of the commits that have > changed this line. > > It looks like I can write a script to do this > > git blame -L /SUBLEVEL/,+1 -M Makefile 57f8f7b6^ > 6e86841d (Linus Torvalds 2008-07-28 19:40:31 -0700 3) SUBLEVEL = 27 > git blame -L /SUBLEVEL/,+1 -M Makefile 6e86841d^ > 2ddcca36 (Linus Torvalds 2008-05-03 11:59:44 -0700 3) SUBLEVEL = 26 > > etc. > > is there a better way to do this? > > David Lang I think you need a script to do what you want. I think this works... Save the following script in ~/bin/git-rblame.sh, make it executable, and then create a global git alias for it as follows: $ git config --global alias.rblame '!~/bin/git-rblame.sh $*' Then you can just use $ git rblame -L /SUBLEVEL/,+1 -M Makefile 6e86841d (Linus Torvalds 2008-07-28 19:40:31 -0700 3) SUBLEVEL = 27 2ddcca36 (Linus Torvalds 2008-05-03 11:59:44 -0700 3) SUBLEVEL = 26 ... 4c91aedb (Linus Torvalds 2005-06-28 22:57:29 -0700 3) SUBLEVEL = 13 ^1da177e (Linus Torvalds 2005-04-16 15:20:36 -0700 3) SUBLEVEL = 12 ------cut here ------ !/bin/git-rblame.sh --- #!/bin/sh PARAMS="$*" LINE=$(git blame $PARAMS) while test $? == 0 do echo $LINE COMMIT="${LINE:0:8}^" LINE=$(git blame $PARAMS $COMMIT 2>/dev/null) done ------cut here ------------------------------ Cheers, Bernt -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html