Hi Christina,

Unfortunately (or fortunately?) it's not going to happen.

A long while ago there was a sharply worded post by Linus [1], who wrote Git, for Linux, about why and how a VCS should work, and it did not require the user to have to tell the computer about 'filenames'. The important part is the content, the source code, while the filenames are arbitrary metadata.

The best way at the moment is NOT to both change the filename, and some content, in the same step. Rather, change the filename in commit 1, and then change content in commit 2. This greatly simplifies the use of the `--follow` option as the object name of the file content is unchanged at step 1, and the file name change is immediately detected (same place, same thing, different name: easy).

If you split a file, then if needed change name first (so the primary name linkage is obvious), and then create and split the file at the separator ('eol') characters, so that you get two crisp 'halves' - again following is then simpler. (this step for determining the split maybe something that could be eased, but..)

Philip

[1] try https://public-inbox.org/git/?q=d%3A..20071130+f%3ALinus+rename+detect to see the bits of discussion, even drop the 'detect' part, eventually find for example [2] [3] and [4]
[2] https://public-inbox.org/git/[email protected]/
[3] https://public-inbox.org/git/[email protected]/ [4] https://public-inbox.org/git/[email protected]/

On 10/12/2019 19:18, Christina Zhou wrote:

Hello,

I’m wondering about keeping the history of a file when you rename it. It seems like while working on a team, a lot of reasonable requests to change filenames are made, but I don’t want to lose my history simply because I renamed it. According to this post <https://stackoverflow.com/questions/2314652/is-it-possible-to-move-rename-files-in-git-and-maintain-their-history> it’s not possible without a lot of maneuvering.

Does anyone plan to implement this feature? I’m guessing that there’s probably a good reason why it’s not implemented, though I wouldn’t know.

Thanks,

Christina

--
You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/b2dc1f7e-b3d2-4a6e-96bc-0d5e7578f74a%40googlegroups.com <https://groups.google.com/d/msgid/git-users/b2dc1f7e-b3d2-4a6e-96bc-0d5e7578f74a%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/4170c1bc-94ee-fd15-3b92-ce229bfd3467%40iee.email.

Reply via email to