I want to rebase my feature branch into dev branch, so I do
git checkout feature
git rebase dev
Current branch feature is up to date
git checkout dev
dev is your primary branch.
If you initial branched
feature off of
dev (or another branch that was at the same commit point as dev HEAD) and no changes have been commited to
dev since that branching, when inside
feature (as you are by doing the checkout) if you rebase to
dev, nothing should happen.
dev is already
feature's base commit.
If commits had been made to
dev, then the rebase would have rebased feature to the new
You don't want to rebase
dev, you rebase your
feature branch if needed (if
dev having changed while working on your feature), then merge the rebased feature branch back into
Here's my flow assuming dev is my primary branch:
git checkout dev git checkout -b feature
Now I'm in my feature branch. I Made some changes to feature branch commit them, maybe dev has changed in meantime. Still on feature branch, so changing back to dev to look for any changes
git checkout dev git pull origin dev
So changes happened on dev, so I want to rebase my feature branch
git checkout feature git rebase dev
Now I'm ready to merge my feature branch back into dev
git checkout dev git merge --squash feature
Squash is optional, but it condenses changes in the feature branch into a single commit on merging back to dev.
Finally, push the new dev back up for others to enjoy
git push origin dev