How to git commit --amend a commit that's the base of a branch

Viewed 4993

I have branch foo off of master/head. I wanted to ammend the master/head and have these changes picked up on branch foo. I did the following:

git checkout master
git add ...
git commit --amend
git checkout foo
git rebase master

The problem was the old non-amended commit shows up as part of branch foo after the amend, and it got rebased onto master. I did a git rebase -i and deleted the old commit and that worked, but is there an easier/safer way to modify the commit that's the base of a branch? And yes, it's all local commits that haven't been pushed..

1 Answers
Related