Is there a nice way to call git mv
on a file from within magit? I know it's possible to run any git command with :, but this won't autocomplete filenames.
I'm not sure offhand if there's a direct way, but...
Given that a mv
is the same thing as a rm
plus an add
, you can just rename the file normally (e.g. in dired), and then stage both of the consequent changes -- a deleted file and a new file.
Git should figure it out.
Edit:
M-x vc-rename-file
?
: mv /path/to/file1 /path/to/file2
(from a magit buffer) is even quicker, but it doesn't autocomplete. –
Chough vc-rename-file
does what I want! –
Chough git mv
? I'm getting the error: "Please update files before moving them" –
Dactyl -f
option might do the trick. (Failing that, you could always just copy the file, and manually restore it after merging.) –
Birkle For reference at least in current verion of magit there is magit-file-rename
which can be invoked by R.
magit-file-move
too. –
Biff R
to invoke magit-file-rename –
Grimace I'm not sure offhand if there's a direct way, but...
Given that a mv
is the same thing as a rm
plus an add
, you can just rename the file normally (e.g. in dired), and then stage both of the consequent changes -- a deleted file and a new file.
Git should figure it out.
Edit:
M-x vc-rename-file
?
: mv /path/to/file1 /path/to/file2
(from a magit buffer) is even quicker, but it doesn't autocomplete. –
Chough vc-rename-file
does what I want! –
Chough git mv
? I'm getting the error: "Please update files before moving them" –
Dactyl -f
option might do the trick. (Failing that, you could always just copy the file, and manually restore it after merging.) –
Birkle I use dired for this. C-x d
when the file is open, then press !
on the file to run git mv ? newpath
command with the file as the ?
argument.
© 2022 - 2024 — McMap. All rights reserved.
git mv
does? Do you realize that git does not track moves? git mv will just rename the file, remove the old name from the index and adds the new one. – Bevbevanmv
. – Chough