On Tue, 28 Jul 2015 13:30:56 -0700
Ying Huang <huangyi...@gmail.com> wrote:

>   Hi, I am trying to visually show a file change history.
>   I have a file, named hello.txt, and 3 commits on it, they are:
> _ 1b0e691e55caa8fd2b5dd6902f77c406fb68e648__
> __ d058c095f7e98a7ebe943c18f87ef087c723bb9f__
> __ c4d1769183ab6d852c624e71e6a0ca00dc3b6d13__
> _
>   Please note: they might not be continuous.
>   The way to find all the commits on this file is by following
> command: _git log --follow hello.txt|awk '/commit/{print $2}'_

This can be done without awk:

  git log --oneline --format %H --follow -- hello.txt

>   Now, I want to show every visual diff of the 3, against their 
> respective parent.

  git difftool <sha1> <sha1>^1

should do that, meaning "run the configured difftool to show the
difference between the commit at <sha1> and the commit which is the
first (left) or the sole parent of thatc commit".

>   Let's take 1b0e691e55caa8fd2b5dd6902f77c406fb68e648 as example:
>   The following command will give me a view on the commit details on 
> this file, and since I have configured kdiff3 as the difftool, so it 
> will pop up a kdiff3 windows to display the differences.
> _ git difftool 1b0e691e55caa8fd2b5dd6902f77c406fb68e648^! hello.txt_
>   So, I continue to use a while loop to try to see all the 3 commits 
> diff view
> _ git log --follow hello.txt|awk '/commit/{print $2}'|while read ss;
> do git difftool $ss^! hello.txt; done_

OK, so I'd rephrase this like

  git log --oneline --format %H --follow -- hello.txt \
    | while read name; do
      git difftool "$name" "$name^1"

Please read the gitrevisions manual page on that <rev>^n notation
(run `git help revisions`).

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to