I had the following in my repo
Master---
\
Next-->Commit A.1,Commit A.2,Commit A.3 --......
I want to fix-up the A.* commits into one commit describing the feature A.
I tried git rebase -i origin next
, but that didn't work how I expected.
Is there any way of accomplishing this?
I thought of creating a branch foo, which is essentially next, and then rebase next onto foo followed by merge/delete foo. However, this seems sloppy.
You can do this two ways (when getting the changes from the remote server): git fetch; git rebase. git pull --rebase.
What is git rebase? From a content perspective, rebasing is changing the base of your branch from one commit to another making it appear as if you'd created your branch from a different commit. Internally, Git accomplishes this by creating new commits and applying them to the specified base.
To rebase, make sure you have all the commits you want in the rebase in your master branch. Check out the branch you want to rebase and type git rebase master (where master is the branch you want to rebase on).
You just need to do:
git rebase -i <COMMIT-ISH>
... where <COMMIT-ISH>
is some way of referring to the commit marked Master
in your diagram. If there's a branch pointing to that point (probably master
or origin/master
) then git log --decorate
will show that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With