I have some changes to be committed in one file, already added (but not committed). The file has other changes in the current directory, which are not to be committed. But I need to edit some of the changes that are about to be committed, before I actually commit. Clear? I thought so!
» git status
On branch dev
Your branch is ahead of 'origin/dev' by 2 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: myfile <-- I need to edit this
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: myfile <-- I do not care about this (for this specific commit)
So, before actually committing, I want to change the staged changes. git commit -i
lets me manually edit a patch. Can I somehow use this feature directly on the staged changes?
Another way to solve this would be to stash the non-staged changes, edit the file in the working directory and adding those changes. But I have the impression that when I unstash I will get conflicts.