Every time I rebase my local branch, git status
shows something like this:
# On branch --blah--
# Your branch is ahead of 'origin/--blah--' by 11 commits.
Only after I push to the branch (which doesn't push anything actually) it says Everything up-to-date
.
This is strange behavior, and I suspect there is something fundamental that I'm missing. Why this is happening?
What git rebase origin/branch
does is to put your work on top of the origin/branch
branch in your local copy.
when you have:
local_branch: 1--2--3--4--1'--2'--3'
remote_branch: 1--2--3--4--a--b--c
then by issuing git rebase remote_branch
you end up with
local_branch: 1--2--3--4--a--b--c--1'--2'--3'
remote_branch: 1--2--3--4--a--b--c
which means that currently your local_branch is indeed some commits ahead of the remote that you rebased on.
after that a git push
will result in
local_branch: 1--2--3--4--a--b--c--1'--2'--3'
remote_branch: 1--2--3--4--a--b--c--1'--2'--3'
so your local will then be up to date
Check out the git-rebase doc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.