emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming files with git not all that bad?


From: Yuri Khan
Subject: Re: Renaming files with git not all that bad?
Date: Thu, 9 Dec 2021 12:40:22 +0700

On Thu, 9 Dec 2021 at 10:20, Stefan Kangas <stefan@marxist.se> wrote:

> > The big drawback here is that we will lose the git history.
>
> I tested this just now, and unless I'm missing something, a rename
> actually doesn't have to be all that bad.  It turns out that
> vc-annotate, magit-blame and vc-region-history have little trouble
> handling a rename if its done properly.
>
> In any case, I made a commit containing no other changes than
>
>     git mv lisp/image-dired.el lisp/image

There is also a trick to split a file into multiple parts where each
part retains its history.

https://devblogs.microsoft.com/oldnewthing/20190916-00/?p=102892

The gist of it is:

* From the original point, start multiple branches, one for each part.
* On each branch:
  * Rename the original file to the file name of the target part, and
commit just this renaming.
  * Then, remove the lines that do not belong to this part, and also commit.
* Finally, do an octopus merge on all the branches together.

This way, each part traces its ancestry to the original file through a
rename-only commit.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]