* Git diff|status against remote repo
@ 2019-09-16 9:02 Stefanie Leisestreichler
2019-09-16 10:45 ` Pratyush Yadav
0 siblings, 1 reply; 3+ messages in thread
From: Stefanie Leisestreichler @ 2019-09-16 9:02 UTC (permalink / raw)
To: git
Hi.
I am far from being a pro in git.
There is something I do not understand.
This is my git config:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://git@192.168.2.2:/home/git/PROJECT.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "develop"]
remote = origin
merge = refs/heads/develop
I have a local repo called "develop" also on each involved dev machine.
Developer A has made changes on nearly each file of the project by
changing the namespace and locally commited those changes to his local
branch "develop". After that he did a git push.
On a not involved machine M I did a git clone
ssh://git@192.168.2.2:/home/git/PROJECT.git and after that I did a "git
checkout develop" which was followed by a message like "Branch develop
is following remote branch develop from origin". I can see all the
changes Developer A has made.
On my machine DEV I am on my local branch develop. Since I did not pull
or merge from origin already, I am not able to see any of those changes
developer A has made. So far so good. But I would expect, that git
status (which results in "On branch develop. Your branch is up to date
with origin/develop) or "git diff origin/develop develop" or "git diff
origin/develop...develop" (both no output at all) would give me a hint
that I am x commits behind origin/master or (git diff) will show me the
changes Developer A committed to the Repro. But nothing...
What am I doing wrong?
Thanks,
Steffi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Git diff|status against remote repo
2019-09-16 9:02 Git diff|status against remote repo Stefanie Leisestreichler
@ 2019-09-16 10:45 ` Pratyush Yadav
2019-09-16 11:31 ` Stefanie Leisestreichler
0 siblings, 1 reply; 3+ messages in thread
From: Pratyush Yadav @ 2019-09-16 10:45 UTC (permalink / raw)
To: Stefanie Leisestreichler; +Cc: git
On 16/09/19 11:02AM, Stefanie Leisestreichler wrote:
> Hi.
>
> I am far from being a pro in git.
> There is something I do not understand.
>
> This is my git config:
> [core]
> repositoryformatversion = 0
> filemode = true
> bare = false
> logallrefupdates = true
> [remote "origin"]
> url = ssh://git@192.168.2.2:/home/git/PROJECT.git
> fetch = +refs/heads/*:refs/remotes/origin/*
> [branch "master"]
> remote = origin
> merge = refs/heads/master
> [branch "develop"]
> remote = origin
> merge = refs/heads/develop
>
> I have a local repo called "develop" also on each involved dev machine.
>
> Developer A has made changes on nearly each file of the project by changing
> the namespace and locally commited those changes to his local branch
> "develop". After that he did a git push.
>
> On a not involved machine M I did a git clone
> ssh://git@192.168.2.2:/home/git/PROJECT.git and after that I did a "git
> checkout develop" which was followed by a message like "Branch develop is
> following remote branch develop from origin". I can see all the changes
> Developer A has made.
>
> On my machine DEV I am on my local branch develop. Since I did not pull or
> merge from origin already, I am not able to see any of those changes
> developer A has made. So far so good. But I would expect, that git status
> (which results in "On branch develop. Your branch is up to date with
> origin/develop) or "git diff origin/develop develop" or "git diff
> origin/develop...develop" (both no output at all) would give me a hint that
> I am x commits behind origin/master or (git diff) will show me the changes
> Developer A committed to the Repro. But nothing...
>
> What am I doing wrong?
You haven't gotten the new commits from origin, so your local repo can't
know how ahead/behind it is from its remote version.
Run `git fetch origin`.
Now if you run `git status`, it should show you that you are X commits
behind origin.
`git pull` does two things: `git fetch` and `git merge`. fetch
"downloads" all the commits from remote, and merge then puts them in
your local branch. So if you do a `git pull`, developer A's changes are
now merged into your tree. But if you only do a fetch, origin/master
gets updated, but not your local master. So now status can know how far
you are behind, but your local branch is not changed yet.
Once you are ready to finally get those changes in your local branch,
run `git merge origin/master`.
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Git diff|status against remote repo
2019-09-16 10:45 ` Pratyush Yadav
@ 2019-09-16 11:31 ` Stefanie Leisestreichler
0 siblings, 0 replies; 3+ messages in thread
From: Stefanie Leisestreichler @ 2019-09-16 11:31 UTC (permalink / raw)
To: Pratyush Yadav; +Cc: git
Am 16.09.19 um 12:45 schrieb Pratyush Yadav:
> On 16/09/19 11:02AM, Stefanie Leisestreichler wrote:
>> Hi.
>>
>> I am far from being a pro in git.
>> There is something I do not understand.
>>
>> This is my git config:
>> [core]
>> repositoryformatversion = 0
>> filemode = true
>> bare = false
>> logallrefupdates = true
>> [remote "origin"]
>> url = ssh://git@192.168.2.2:/home/git/PROJECT.git
>> fetch = +refs/heads/*:refs/remotes/origin/*
>> [branch "master"]
>> remote = origin
>> merge = refs/heads/master
>> [branch "develop"]
>> remote = origin
>> merge = refs/heads/develop
>>
>> I have a local repo called "develop" also on each involved dev machine.
>>
>> Developer A has made changes on nearly each file of the project by changing
>> the namespace and locally commited those changes to his local branch
>> "develop". After that he did a git push.
>>
>> On a not involved machine M I did a git clone
>> ssh://git@192.168.2.2:/home/git/PROJECT.git and after that I did a "git
>> checkout develop" which was followed by a message like "Branch develop is
>> following remote branch develop from origin". I can see all the changes
>> Developer A has made.
>>
>> On my machine DEV I am on my local branch develop. Since I did not pull or
>> merge from origin already, I am not able to see any of those changes
>> developer A has made. So far so good. But I would expect, that git status
>> (which results in "On branch develop. Your branch is up to date with
>> origin/develop) or "git diff origin/develop develop" or "git diff
>> origin/develop...develop" (both no output at all) would give me a hint that
>> I am x commits behind origin/master or (git diff) will show me the changes
>> Developer A committed to the Repro. But nothing...
>>
>> What am I doing wrong?
>
> You haven't gotten the new commits from origin, so your local repo can't
> know how ahead/behind it is from its remote version.
>
> Run `git fetch origin`.
>
> Now if you run `git status`, it should show you that you are X commits
> behind origin.
>
> `git pull` does two things: `git fetch` and `git merge`. fetch
> "downloads" all the commits from remote, and merge then puts them in
> your local branch. So if you do a `git pull`, developer A's changes are
> now merged into your tree. But if you only do a fetch, origin/master
> gets updated, but not your local master. So now status can know how far
> you are behind, but your local branch is not changed yet.
>
> Once you are ready to finally get those changes in your local branch,
> run `git merge origin/master`.
>
Thanks a lot. git fetch did the trick.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-16 11:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16 9:02 Git diff|status against remote repo Stefanie Leisestreichler
2019-09-16 10:45 ` Pratyush Yadav
2019-09-16 11:31 ` Stefanie Leisestreichler
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).