I have a previous commit.
After that commit I edited a file. But after that I messed up one thing.
I want to return to a previous commit but save changes in that one file. The file hasn't been committed.
How can I achieve this?
P.S.: I know that I can simply copy the contents of that file that I edited and after the returning to an older commit just paste it in there, but I want to learn how to do it using Git since there could be more complicated scenarios.
git commit --fixup
and interactive rebase? In other words: do you want to apply the changes to the older commit?git log --graph
currently and the desired output, we can answer exactly. Also it's not clear if your latest edit has been committed yet.stash
or commit on a temporary branch