Recently I've been using git with a system that applies patches as commits (Phabricator & Arcanist, but I don't think thats important for this question).
I often end up in the situation where I have a patch applied in the form of a commit, but I would like to edit that commit.
Of course I can always make edits and git commit --amend
, but I'd also like to be able to do git diff
, use meld .
and other tools which assume edits are made on-top of the last commit.
Currently I do the following.
git diff HEAD~1 > temp.diff
git reset --hard HEAD~1
git apply temp.diff
rm temp.diff
Edit patch...
git commit -a
However this seems a bit clumsy, Is there some way to set the git repository to a another sha1, but keep the current working copy intact?