0
X -- Y -- Z <-- master
       \
        A -- B <-- your-cool-branch

You want to contribute the code back to the master foobar repo, but you realize there is a really dumb typo in one of your source code comments in commit A. You'd still like to submit the pull request as two commits A' and B', where A' is the fixed version of A, and B' is the same exact diff as B. How do you rewrite git history to make this happen?

Makoto
  • 104,088
  • 27
  • 192
  • 230
Nick Bb
  • 601
  • 1
  • 8
  • 18
  • where exactly is your problem? make it clear so people can help. This is not a "code for me" platform. – Torben Apr 11 '17 at 14:51
  • 1
    Possible duplicate of [How to modify existing, unpushed commits?](http://stackoverflow.com/questions/179123/how-to-modify-existing-unpushed-commits) – mkrieger1 Apr 11 '17 at 14:56

1 Answers1

0

git rebase -i will get you started. From there, you'll see commit A and B, and the only thing you'd need to do is change the instruction on commit A from pick to edit.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Makoto
  • 104,088
  • 27
  • 192
  • 230