{"thread":{"id":"51857","subject":"Git diff|status against remote repo","startedAt":"2019-09-16T09:45:52Z","lastAt":"2019-09-16T11:31:18Z","messageCount":3,"participants":["Stefanie Leisestreichler","Pratyush Yadav"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"382413","messageId":"3218b394-4dcf-0b99-c561-b1811f0be3d6@peter-speer.de","threadId":"51857","inReplyTo":null,"subject":"Git diff|status against remote repo","fromName":"Stefanie Leisestreichler","fromEmail":"stefanie.leisestreichler@peter-speer.de","sentAt":"2019-09-16T09:02:20Z","receivedAt":"2019-09-16T09:45:52Z","isPatch":false,"sender":{"key":"stefanie.leisestreichler@peter-speer.de","avatar":null},"body":"Hi.\n\nI am far from being a pro in git.\nThere is something I do not understand.\n\nThis is my git config:\n[core]\n         repositoryformatversion = 0\n         filemode = true\n         bare = false\n         logallrefupdates = true\n[remote \"origin\"]\n         url = ssh://git@192.168.2.2:/home/git/PROJECT.git\n         fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n         remote = origin\n         merge = refs/heads/master\n[branch \"develop\"]\n         remote = origin\n         merge = refs/heads/develop\n\nI have a local repo called \"develop\" also on each involved dev machine.\n\nDeveloper A has made changes on nearly each file of the project by \nchanging the namespace and locally commited those changes to his local \nbranch \"develop\". After that he did a git push.\n\nOn a not involved machine M I did a git clone \nssh://git@192.168.2.2:/home/git/PROJECT.git and after that I did a \"git \ncheckout develop\" which was followed by a message like \"Branch develop \nis following remote branch develop from origin\". I can see all the \nchanges Developer A has made.\n\nOn my machine DEV I am on my local branch develop. Since I did not pull \nor merge from origin already, I am not able to see any of those changes \ndeveloper A has made. So far so good. But I would expect, that git \nstatus (which results in \"On branch develop. Your branch is up to date \nwith origin/develop) or \"git diff origin/develop develop\" or \"git diff \norigin/develop...develop\" (both no output at all) would give me a hint \nthat I am x commits behind origin/master or (git diff) will show me the \nchanges Developer A committed to the Repro. But nothing...\n\nWhat am I doing wrong?\n\nThanks,\nSteffi\n\n"},{"id":"382414","messageId":"20190916104505.cykdm2edrz7wy3fm@yadavpratyush.com","threadId":"51857","inReplyTo":"3218b394-4dcf-0b99-c561-b1811f0be3d6@peter-speer.de","subject":"Re: Git diff|status against remote repo","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-09-16T10:45:05Z","receivedAt":"2019-09-16T10:45:13Z","isPatch":false,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On 16/09/19 11:02AM, Stefanie Leisestreichler wrote:\n> Hi.\n> \n> I am far from being a pro in git.\n> There is something I do not understand.\n> \n> This is my git config:\n> [core]\n>         repositoryformatversion = 0\n>         filemode = true\n>         bare = false\n>         logallrefupdates = true\n> [remote \"origin\"]\n>         url = ssh://git@192.168.2.2:/home/git/PROJECT.git\n>         fetch = +refs/heads/*:refs/remotes/origin/*\n> [branch \"master\"]\n>         remote = origin\n>         merge = refs/heads/master\n> [branch \"develop\"]\n>         remote = origin\n>         merge = refs/heads/develop\n> \n> I have a local repo called \"develop\" also on each involved dev machine.\n> \n> Developer A has made changes on nearly each file of the project by changing\n> the namespace and locally commited those changes to his local branch\n> \"develop\". After that he did a git push.\n> \n> On a not involved machine M I did a git clone\n> ssh://git@192.168.2.2:/home/git/PROJECT.git and after that I did a \"git\n> checkout develop\" which was followed by a message like \"Branch develop is\n> following remote branch develop from origin\". I can see all the changes\n> Developer A has made.\n> \n> On my machine DEV I am on my local branch develop. Since I did not pull or\n> merge from origin already, I am not able to see any of those changes\n> developer A has made. So far so good. But I would expect, that git status\n> (which results in \"On branch develop. Your branch is up to date with\n> origin/develop) or \"git diff origin/develop develop\" or \"git diff\n> origin/develop...develop\" (both no output at all) would give me a hint that\n> I am x commits behind origin/master or (git diff) will show me the changes\n> Developer A committed to the Repro. But nothing...\n> \n> What am I doing wrong?\n\nYou haven't gotten the new commits from origin, so your local repo can't \nknow how ahead/behind it is from its remote version.\n\nRun `git fetch origin`.\n\nNow if you run `git status`, it should show you that you are X commits \nbehind origin.\n\n`git pull` does two things: `git fetch` and `git merge`. fetch \n\"downloads\" all the commits from remote, and merge then puts them in \nyour local branch. So if you do a `git pull`, developer A's changes are \nnow merged into your tree. But if you only do a fetch, origin/master \ngets updated, but not your local master. So now status can know how far \nyou are behind, but your local branch is not changed yet.\n\nOnce you are ready to finally get those changes in your local branch, \nrun `git merge origin/master`.\n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"382417","messageId":"3f0ad1d5-aed4-9bfa-d3f6-09bae21a5dca@peter-speer.de","threadId":"51857","inReplyTo":"20190916104505.cykdm2edrz7wy3fm@yadavpratyush.com","subject":"Re: Git diff|status against remote repo","fromName":"Stefanie Leisestreichler","fromEmail":"stefanie.leisestreichler@peter-speer.de","sentAt":"2019-09-16T11:31:15Z","receivedAt":"2019-09-16T11:31:18Z","isPatch":false,"sender":{"key":"stefanie.leisestreichler@peter-speer.de","avatar":null},"body":"\n\nAm 16.09.19 um 12:45 schrieb Pratyush Yadav:\n> On 16/09/19 11:02AM, Stefanie Leisestreichler wrote:\n>> Hi.\n>>\n>> I am far from being a pro in git.\n>> There is something I do not understand.\n>>\n>> This is my git config:\n>> [core]\n>>          repositoryformatversion = 0\n>>          filemode = true\n>>          bare = false\n>>          logallrefupdates = true\n>> [remote \"origin\"]\n>>          url = ssh://git@192.168.2.2:/home/git/PROJECT.git\n>>          fetch = +refs/heads/*:refs/remotes/origin/*\n>> [branch \"master\"]\n>>          remote = origin\n>>          merge = refs/heads/master\n>> [branch \"develop\"]\n>>          remote = origin\n>>          merge = refs/heads/develop\n>>\n>> I have a local repo called \"develop\" also on each involved dev machine.\n>>\n>> Developer A has made changes on nearly each file of the project by changing\n>> the namespace and locally commited those changes to his local branch\n>> \"develop\". After that he did a git push.\n>>\n>> On a not involved machine M I did a git clone\n>> ssh://git@192.168.2.2:/home/git/PROJECT.git and after that I did a \"git\n>> checkout develop\" which was followed by a message like \"Branch develop is\n>> following remote branch develop from origin\". I can see all the changes\n>> Developer A has made.\n>>\n>> On my machine DEV I am on my local branch develop. Since I did not pull or\n>> merge from origin already, I am not able to see any of those changes\n>> developer A has made. So far so good. But I would expect, that git status\n>> (which results in \"On branch develop. Your branch is up to date with\n>> origin/develop) or \"git diff origin/develop develop\" or \"git diff\n>> origin/develop...develop\" (both no output at all) would give me a hint that\n>> I am x commits behind origin/master or (git diff) will show me the changes\n>> Developer A committed to the Repro. But nothing...\n>>\n>> What am I doing wrong?\n> \n> You haven't gotten the new commits from origin, so your local repo can't\n> know how ahead/behind it is from its remote version.\n> \n> Run `git fetch origin`.\n> \n> Now if you run `git status`, it should show you that you are X commits\n> behind origin.\n> \n> `git pull` does two things: `git fetch` and `git merge`. fetch\n> \"downloads\" all the commits from remote, and merge then puts them in\n> your local branch. So if you do a `git pull`, developer A's changes are\n> now merged into your tree. But if you only do a fetch, origin/master\n> gets updated, but not your local master. So now status can know how far\n> you are behind, but your local branch is not changed yet.\n> \n> Once you are ready to finally get those changes in your local branch,\n> run `git merge origin/master`.\n> \n\nThanks a lot. git fetch did the trick.\n"}]}