When I\'ve worked a bit with my source code, I did my usual thing commit and then I pushed to a remote repository. But then I noticed I forgot to organize my imports in the
Here, How I fixed an edit in a previous commit:
Save your work so far.
Stash your changes away for now if made: git stash
Now your working copy is clean at the state of your last commit.
Make the edits and fixes.
Commit the changes in "amend" mode: git commit --all --amend
Your editor will come up asking for a log message (by default, the old log message). Save and quit the editor when you're happy with it.
The new changes are added on to the old commit. See for yourself with git log
and git diff HEAD^
Re-apply your stashed changes, if made: git stash apply