0 votes
1 view
in DevOps and Agile by (30k points)

I would like to rename/move a project subtree in Git moving it from




If I use a plain git mv project components, then all the commit history for the Xyz project gets lost. Is there a way to move this such that the history is maintained?

1 Answer

0 votes
by (51.2k points)

Git will detect the renames, so it doesn’t matter whether you use git mv or just mv.

And the log command with --follow option will help your git to continue the history before the rename.

For full history use this command:

git log --follow ./path/to/file

Reference:  https://git-scm.com/docs/git-log#Documentation/git-log.txt---follow

Welcome to Intellipaat Community. Get your technical queries answered by top developers !