I'm now on develop
branch on my project. And I want to pull and merge from branch origin/Jim
.
There'are some changes between these two branch like below:
git diff develop origin/Jim --stat
VERSION | 2 -
api/account/models.py | 32 --
api/account/views.py | 175 --------
But when I run command
git pull origin Jim
It always show me
* branch Jim -> FETCH_HEAD
Already up to date.
What's wrong with my trial.
Thanks
CodePudding user response:
There's nothing unusual about what you have posted. This:
git diff develop origin/Jim --stat VERSION | 2 - api/account/models.py | 32 -- api/account/views.py | 175 --------
shows some differences in the commit named by developer
(hash ID a123456
, perhaps: use git rev-parse developer
to see the exact hash ID), vs the commit named by origin/Jim
(a different hash ID—use git rev-parse
again if desired—but let's just say it might be commit 9876543
).
This:
git pull origin Jim
"means", to Git, that Git should run the following two commands:
git fetch origin Jim
git merge -m ... FETCH_HEAD
(I've omitted the actual -m
argument here, and a few other minor items). The git fetch
step causes your Git to reach out to some other Git software: your Git calls up the URL stored under remote.origin.url
, and some other Git version answers that Internet "phone call" and connects to another (different) repository and collects from that repository any commits they have, that you don't, that you might need in order to update your origin/Jim
.
This output:
* branch Jim -> FETCH_HEAD
implies (depending on your own Git version) that there were no new commits they had that you didn't, so your origin/Jim
was already up to date with their Jim
. No problem so far: this just means there was nothing to fetch.
The second command, git merge FETCH_HEAD
, is then equivalent to git merge origin/Jim
. This finds a commit hash ID—9876543
again, in our example here—and tries merging your current (HEAD
) commit with that commit.
We don't know what commit is your current commit. We don't know which branch, if any, you're on. But even if you are on develop
, so that your current commit is a123456
, this can still produce:
Already up to date.
It will do so if your commit—a123456
—is strictly "ahead of" commit 9876543
as found under the name FETCH_HEAD
.
What we know for sure at this point is that you are, at your current commit, even with or strictly ahead of the FETCH_HEAD
commit. The merge command does not mean overwrite everything, throwing away my changes. You have changes that add on to their work; your git merge
is keeping your changes. They have no new work to add on to your work, so there is nothing else to do.
CodePudding user response:
Did you commit and push your branch to the server?
maybe it is not synced with the Git server. try to commit your branch and push it to the server.