Answer the question
In order to leave comments, you need to log in
How to save file rename after git reset head^?
When I need to switch to another task, on the current branch, I just do git commit -am 1 , then come back, do git reset head^ , and keep going.
The crux of the matter is this - for example, there is a renamed file in a commit, but git reset head^ removes the old file and adds a new one.
$ git mv 1.txt 2.txt
$ git status
renamed: 1.txt -> 2.txt
$ git commit -am test
1 file changed, 0 insertions(+), 0 deletions(-)
rename 1.txt => 2.txt (100%)
$ git reset head^
$ git status
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: 1.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
2.txt
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question