-->

History of subtree merged files

2019-05-26 22:31发布

问题:

I wanted to merge a folder from one repository to another according to the subtree merge method (according to How do you merge two Git repositories? and http://nuclearsquid.com/writings/subtree-merging-and-you/)

Now I'm confused since the files I added seem to have forgotten their history:

git log -p oneMergedFile

gives me a diff looking as if the file was newly added, while

git log

gives me the full history, i.e. containing the history of the merged branch. How can I get the entire history for oneMergedFile?

回答1:

-p oneMergedFile only shows the changes made to that file. Perhaps it wasn't part of your merge?

you could try gitk oneMergedFile to get a more visual history

one thing you could check is your config file for log.showroot

If false, git log and related commands will not treat the initial commit as a big creation event. Any root commits in git log -p output would be shown without a diff attached. The default is true.

Another possibility is that the merge included no changes the files you specified in -p. You could try --full-diff, which I think will show the file anyway.