免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年5月14日 星期四

git, how to show history for a certain file


http://stackoverflow.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning
"""...
use
$ git log -p filename
to let git generate the patches for each log entry.

...
use
$ gitk
to browse the changes visually.

...
$ git log --follow -p -- file
In other words, if the file named bar was once named foo, then git log -p bar (without the --follow option) will only show the file's history up to the point where it was renamed -- it won't show the file's history when it was known as foo.

Using git log --follow -p bar will show the file's entire history, including any changes to the file when it was known as foo.
...


..."""

after
$ git log -p file1

then scroll down to the target date you need,
copy the commit-id,

then
$ git checkout commit-id file1

$ cp file1 file1_old.bak

# restore file1 to that on master branch
$ git checkout master file1

# extract what you need from file1_old.bak to merge into file1 on branch master ...





沒有留言:

張貼留言