Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. Stash your changes (git stash).

  2. Run git rebase -i origin/master (or the branch base if you’re forking something else than master).

  3. Mark the commit(s) you want to amend with "edit" in the first column

  4. Save the edit plan. Git will present you the commits to edit one by one.

  5. For each commit to amend, make the changes you wish . (Unstash and reuse only parts of the stash relevant to the current commit.) (or git stash pop if you stashed some changes above). Then check the resulting code builds and passes its unit tests.

  6. Run git add -p on the desired changes, then git commit --amend; polish the commit message for that commit.

  7. Stash the rest.

  8. Once you finish editing each commit, run git rebase --continue to go to the next commit in the list you've selected at step 2. Iterate steps 5-8 until completion.