Git: difference "git rebase origin/branch" VS "git rebase origin branch"
@Mar's answer is right and perfectly solved this question, just add one comment.
if you want to rebase a branch based on remote master branch, git rebase origin/master
is not enough, it will not get new commits directly from origin/master. You need to git fetch
before 'git rebase origin/master'.
or you can use another way to rebase a branch.
- switch to master
git checkout master
git pull origin master
- switch back to your own branch
git checkout {your branch}
git rebase origin/master
then, your branch is updated to newest commits.
git rebase <upstream> <branch>
is equal to
git checkout <branch>git rebase <upstream>
By default <branch>
is HEAD
.
[1] https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html