Reputation: 485
I need to make a change and submit it as a separate commit, right before the commit at the top of my commit stack (size 1).
e.g., right now I have A -- B
Where B is the top my commit stack, and A
is the latest commit I just pulled from origin. I found that I need to make a change and submit a new commit, but it makes more sense to make this change before the changes in commit B
. Let's call the new commit C
, so I want the chain to look like
A--C--B
How can I go about doing this? Should I first make A--B--C
and then swap B
and C
using interactive commit?
Upvotes: 0
Views: 683
Reputation: 125007
Just my local repo for now, which will be pushed up later.
Since these changes only affect your repo, you can reorder the commits any way you like. The easiest way is to just make the change you need, commit it, and then use interactive rebase (git rebase -i ...
) to reorder the commits. You can then force-push (git push -f ...
) to change your remote branch, and your pull request should be updated automatically.
Upvotes: 1