From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: FMorschel <git@fmorschel.dev>, git@vger.kernel.org
Subject: Re: Feature Request: git mv --after (new flag)
Date: Tue, 05 Aug 2025 08:42:00 -0700 [thread overview]
Message-ID: <xmqqh5yl3hdj.fsf@gitster.g> (raw)
In-Reply-To: <4d08a37e-2c12-4e3b-b6a6-028e2d6c0a22@kdbg.org> (Johannes Sixt's message of "Tue, 5 Aug 2025 08:03:46 +0200")
Johannes Sixt <j6t@kdbg.org> writes:
> Am 04.08.25 um 16:05 schrieb FMorschel:
>> This is a request to add an –after mode to git mv command to explicitly
>> mark a filesystem rename after it has occurred (analogous to mercurial
>> => hg mv –after).
>>
>> This would allow IDE/Language refactor renames/moves and would make sure
>> git still detects the moves correctly for keeping the correct commit
>> history.
>
> I've wished for this feature several times already. Though, in Git
> parlance it would be spelled `git mv --cached`.
I couldn't really tell if the request was to make "git mv --after",
without any other argument after it, do something sensible.
E.g. after the end-user did "mv A B", figure out from the paths
that are apparently removed from the working tree relative to what
is recorded in the index (like A, but there may be others), and the
paths that have not been made to known by Git (like B, but there may
be others), and infer what happened, and "git mv --cached A B" for
them.
I do not think we have that "match the missing paths and untracked
paths to figure out" part. It may be trivial if you are willing to
make a stupid version that takes all the untracked paths by trusting
they maintain good .gitignore (it would roughly be "git add ."), but
even if you try to do a much better job and actually avoid adding
paths that are not involved in this "mv", it should not be rocket
science to do so.
But if that is not needed, then we can declare that we already have
it and move on? I dunno.
prev parent reply other threads:[~2025-08-05 15:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1fa7a8d8-3ae5-4913-b3b5-21d8f67e567d@fmorschel.dev>
[not found] ` <0afc01b2-11a2-4f77-a858-7a444e8bb1d4@fmorschel.dev>
2025-08-04 14:05 ` Feature Request: git mv --after (new flag) FMorschel
2025-08-04 15:02 ` Konstantin Khomoutov
2025-08-04 15:53 ` FMorschel
2025-08-04 16:04 ` Kristoffer Haugsbakk
2025-08-04 16:28 ` Junio C Hamano
2025-08-05 9:36 ` Konstantin Khomoutov
2025-08-05 11:47 ` FMorschel
2025-08-06 5:17 ` Junio C Hamano
2025-08-05 6:03 ` Johannes Sixt
2025-08-05 15:42 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh5yl3hdj.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@fmorschel.dev \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).