I did a few commits, say commit A, B, C
Now I want to push only commit A and B to the remote repo. (And keep commit C to be merged and pushed at a later time)
Before I push, I need to run:
git fetch origin master
git rebase --merge FETCH_HEAD
problem is the above commands will ask me to resolve conflicts of commit C as well, which I’m not planning to push now.
Is it possible to do the rebase without having to deal with commit C.
Thanks
Saving before the rebase
The easiest way to save the commit so you can postpone dealing with the conflicts would be to tag it so you have a reference to the commit later:
Rebasing without commit C
After you’ve saved a reference, rebase without the commit:
It should open your editor to file looking like this:
To delete commit C from this branch’s history, simply remove or comment out the commit’s
pick <sha1> <message>line.Note that commits are listed in reverse order, with the oldest commits first, the most recent ones last. The first commit on the list should be the first commit that is not an ancestor of
FETCH_HEAD.Once you’ve rebased without C, go ahead and push:
Reapplying the commit
When you’re ready to apply it on the rebased branch: