How can I get git log to show me the entire history of a file when even git log -M --follow --full-history new/directory/file
failed.
But first a bit of context on the changes not showing...
We imported a git repository inside another one, we proceeded like so:
git clone git@domain.com:namespace/NewRepository
cd NewRepository
git remote add oldRepository git@domain.com:oldNamespace/oldRepository.git
git fetch oldRepository
git checkout -b old-master oldRepository/master
mkdir -p new/directory/
git mv -k * new/directory/
find . -name ".*" -d 1 -exec git mv -k {} new/directory/ \;
git commit -m "Move oldRepository to its new location"
git push --set-upstream origin old-master
git checkout master
git pull
git merge old-master --allow-unrelated-histories
git push
So far so good, after this a git log --follow new/directory/file
would give me the complete changelog of the file.
About a week later, some new changes to the old repository needed to be "pulled" into the new one. We proceeded like so :
git fetch --all
git checkout old-master;
git merge origin/old-master; # I got no conflict (No change actually)
git merge origin/master; # I got no conflict (As expected)
git merge -s subtree -X patience oldRepository/master;
# I am not sure "-X patience" is a thing but that's what we ran.
# But the "-s subtree" is the important part I believe, we got no conflict and all expected changes were found in their new location (Even newly created files)
git push --set-upstream origin old-master
I then created a PR, and then eventually merged it, using the create a merge commit option.
Now if I do git log --follow new/directory/file
the latest commit I see is: Move old repository to its new location
, but I do not get any newer entry from the old repository that was done after the original import. Despite the changes being present in the file.
However :
- A
git blame new/directory/file
does show me next to the modified line the proper info - A
git log
(With no file specified) does show me the commit - A
show history
in my IDE does show me the log entry.
Since my IDE does it, I am guessing there is a combination of flags for git log to show me the proper history, but I tried A LOT of combination and could not figure out. And yes I did read the man page...
Additionally, if a different procedure could have prevented me to get into this situation I would like to know... Doe in retrospect maybe the old-master branch was unnecessary, but originally it seemed like a good idea to have a branch to resolve conflict.
Thanks!