You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is only possible to get the history with the old path, using the --follow command (note also that the path separator is mandatory since the given path doesn't exist anymore):
merged-repo (master)]$ git log --oneline -- treeB/fileB
merged-repo (master)]$ git log --oneline --follow treeB/fileB
fatal: ambiguous argument 'treeB/fileB': unknown revision or path not in the working tree.
merged-repo (master)]$ git log --oneline --follow -- treeB/fileB
8f87ce7 commit B2
e7b06af commit B1
When a file existed in both repositories, the result is either only repoA history, either a mixed history:
However, it's not that easy on a real repository since that "prepare merge" commit must be done on all branches and tags. Also, it pollutes a little the logs and is error-prone.
See https://gist.github.com/jcarsique/29ca0df9166926183e2f
It looks like if the Git tree was missing a rename/move for repoB content from its root to its subdirectory after merge.
Git doesn't track renames/moves, it tries to calculate them on the fly when doing git log and other commands. Also, I think Git is a bit confused by the trees being moved around in the merge commit.
Also, the situation is a little bit improved with a manual commit ("prepare merge") moving the files before the merge
That would be a nice enhancement to contribute to this project. I'm not looking into this currently, so if someone else wants to pick this up, please feel free to do so.
robinst
changed the title
Broken file log history browse
Add option to do moves in a commit before merging different repos
Nov 23, 2014
Hi,
The history browsing is broken on merged content which has been moved to a subdirectory.
Here are reproduction steps.
Starting from the two following repositories:
Then, repoB is merged into repoA under a "repoB" directory:
The global commit history is well preserved and the expected content is there:
The repoA content history is fine:
But it is not possible to log the history of repoB content with its current path beside the merge commit:
It is only possible to get the history with the old path, using the
--follow
command (note also that the path separator is mandatory since the given path doesn't exist anymore):When a file existed in both repositories, the result is either only repoA history, either a mixed history:
In most GUI tools, it is not possible at all to get the history of a file from repoB.
It looks like if the Git tree was missing a rename/move for repoB content from its root to its subdirectory after merge.
The text was updated successfully, but these errors were encountered: