Is there a git command to pull origin/master then rebase the working branch?

Viewed 198

My git workflow involves frequent rebasing. I tend not to merge.

Setup:

$ git branch --show-current
master

$ git branch -b my_changes
<edit files>

When it's time to pull in changes from master:

git commit -am "Made changes"
git checkout master
git pull
git checkout my_changes
git rebase master

Is there a git workflow that could accomplish the same thing with fewer steps?

1 Answers

Is there a git workflow that could accomplish the same thing with fewer steps?

Yes. The branch switching is unnecessary. Stay on your branch, pull into master, and rebase onto master:

git commit -am "Made changes"
git fetch origin master:master
git rebase master

Or, since you probably don't need it, throw your local master away, and:

git commit -am "Made changes"
git fetch 
git rebase origin/master
Related