Re: Proposal: tell git a file has been renamed
- From
- Erik Cervin Edin <erik@cervined.in>
- Date
- May 11, 2023, 13:44 UTC
- Message-ID
- <CA+JQ7M_3jLCXHokbeHB=DyphFO605GE0BTu-cqZsF1ZNExL=kg@mail.gmail.com>
- In-Reply-To
- <xmqqwn1yqsx7.fsf@gitster.g>
Another example of where the current implementation isn't working great
A - B - C
commit A makes changes to foo commit B changes the name of foo to bar commit C symlinks foo => bar
Rebasing the commits and reordering them
commit B changes the name of foo to bar commit C symlinks foo => bar commit A makes changes to foo
is going to result in merge conflicts. The best way to achieve this ordering is actually doing multiple rebases.
commit B changes the name of foo to bar commit A makes changes to foo commit C symlinks foo => bar
followed by
commit B changes the name of foo to bar commit C symlinks foo => bar commit A makes changes to foo
I guess the difficulty that arises from reordering commits like this isn't unique to renames but it arguably results in a more hostile user experience. It requires an unusual amount of discipline and understanding of what is going on to resolve as well as how to avoid it.