-
Bug
-
Resolution: Fixed
-
Low
-
None
-
None
-
None
Intended action:
Amend the commit message for the last commit.
Steps to reproduce:
1. Make a commit for some changes
2. Put at least one other change in the stage index
3. Select "Commit" from the toolbar
4. Select "Amend latest commit" in the lower left corner of the commit dialog
5. Select "Selected files" for Commit mode
6. Unselect all files
7. Change commit message
8. Press "Commit"
Result:
All files in the stage index are committed along with the changed commit message. The stage index is empty.
Expected Result:
Changed commit message for the last commit and unchanged stage index.
Fixed in SourceTree, but a bug in git prevents this from behaving correctly still. Will try to report to git.
The problem was that when no files were selected on the command line, git assumed that you wanted to commit the staged changes. I've changed SourceTree to add the '--only' option in this case which is supposed to prevent this assumption.
The only problem is, it doesn't work. The git manual (http://schacon.github.com/git/git-commit.html) says that when specifying '-
only' or '-o' along with '-amend', it makes git ignore all staged changes. This is not correct however; I've proved this on the command line, if you stage some changes and then issue this command:git commit --amend --only -m "Only change commit"
The staged changes are committed too. This is a bug in git - for the moment please unstage any changes you don't want to get included in the amended commit.