{"thread":{"id":"24490","subject":"Git workflow with upstream repository","startedAt":"2010-07-24T00:58:08Z","lastAt":"2010-07-24T02:39:13Z","messageCount":4,"participants":["Bradley Wagner","Avery Pennarun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"146126","messageId":"AANLkTinyUGLMTQ=ruk69pptDUQ3VyaQ7CwtO+QfeJUVC@mail.gmail.com","threadId":"24490","inReplyTo":null,"subject":"Git workflow with upstream repository","fromName":"Bradley Wagner","fromEmail":"bradley.wagner@hannonhill.com","sentAt":"2010-07-24T00:58:08Z","receivedAt":"2010-07-24T00:58:08Z","isPatch":false,"sender":{"key":"bradley.wagner@hannonhill.com","avatar":"https://gravatar.com/avatar/8304e5020b13d5f8102220fae2f5dd607a2e114dbe62bbd92c1ab38fe0b69fdb?d=mp&s=160"},"body":"Hi, I'm trying to figure out the best way to work with two remote\nrepositories: one origin and an upstream repository.\n\nBasically, with one remote origin I do 'git fetch' and then a 'git\nstatus' which tells me my status as compared to my remote at which\npoint I decide wether I want to rebase or pull/merge.\n\nIf I'm working with another remote repository 'upstream' that I\nperhaps don't have permissions to and then my branches are not\ntracking against, how would I do something similar to be able to first\nsee how my branch compares to the remote and then either rebase or\npull/merge.\n\nAm I missing something in git status that allows me to see my status\nas compared to another remote?\n"},{"id":"146135","messageId":"AANLkTik5U0oh8p42hK-871iwnTA5a66Yj-8pU4xSZS40@mail.gmail.com","threadId":"24490","inReplyTo":"AANLkTinyUGLMTQ=ruk69pptDUQ3VyaQ7CwtO+QfeJUVC@mail.gmail.com","subject":"Re: Git workflow with upstream repository","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-07-24T01:24:54Z","receivedAt":"2010-07-24T01:24:54Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Fri, Jul 23, 2010 at 8:58 PM, Bradley Wagner\n<bradley.wagner@hannonhill.com> wrote:\n> If I'm working with another remote repository 'upstream' that I\n> perhaps don't have permissions to and then my branches are not\n> tracking against, how would I do something similar to be able to first\n> see how my branch compares to the remote and then either rebase or\n> pull/merge.\n\n# show the commits in my local branch that aren't in upstream\ngit log upstream/master..\n\n# show the commits in upstream that aren't in my local branch\ngit log ..upstream/master\n\n# a cuter way to show the commits in upstream that aren't in my local branch\ngit shortlog ..upstream/master\n\n# summarize the differences in upstream since we diverged (not\nincluding my own changes)\ngit diff --stat upstream/master..\n\n# summarize the differences between my branch and upstream (including\nmy changes and theirs)\n# (note: three dots)\ngit diff --stat ...upstream/master\n\nHave fun,\n\nAvery\n"},{"id":"146136","messageId":"AANLkTi=82NDSfizCCjoJ-Sj05DzwXfa35ro60MiWSQdz@mail.gmail.com","threadId":"24490","inReplyTo":"AANLkTik5U0oh8p42hK-871iwnTA5a66Yj-8pU4xSZS40@mail.gmail.com","subject":"Re: Git workflow with upstream repository","fromName":"Bradley Wagner","fromEmail":"bradley.wagner@hannonhill.com","sentAt":"2010-07-24T01:43:56Z","receivedAt":"2010-07-24T01:43:56Z","isPatch":false,"sender":{"key":"bradley.wagner@hannonhill.com","avatar":"https://gravatar.com/avatar/8304e5020b13d5f8102220fae2f5dd607a2e114dbe62bbd92c1ab38fe0b69fdb?d=mp&s=160"},"body":"Thanks, I'll check those out! So, I take it there is not a way to get\na simple message like what git status tells you when you're local\nbranch is behind the remote branch:\n\n\"Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.\"\n\nIs there even a concept of a fast-forward merge when pulling from a\nremote repo that is not the remote to which your branches are\ntracking?\n\nIs it possible to rebase based on a branch that is *not* the branch\nyou're currently tracking? Is that what the --onto flag is for?\n\n- Bradley\n\nOn Jul 23, 2010, at 9:24 PM, Avery Pennarun <apenwarr@gmail.com> wrot\n> On Fri, Jul 23, 2010 at 8:58 PM, Bradley Wagner\n> <bradley.wagner@hannonhill.com> wrote:\n>> If I'm working with another remote repository 'upstream' that I\n>> perhaps don't have permissions to and then my branches are not\n>> tracking against, how would I do something similar to be able to first\n>> see how my branch compares to the remote and then either rebase or\n>> pull/merge.\n>\n> # show the commits in my local branch that aren't in upstream\n> git log upstream/master..\n>\n> # show the commits in upstream that aren't in my local branch\n> git log ..upstream/master\n>\n> # a cuter way to show the commits in upstream that aren't in my local branch\n> git shortlog ..upstream/master\n>\n> # summarize the differences in upstream since we diverged (not\n> including my own changes)\n> git diff --stat upstream/master..\n>\n> # summarize the differences between my branch and upstream (including\n> my changes and theirs)\n> # (note: three dots)\n> git diff --stat ...upstream/master\n>\n> Have fun,\n>\n> Avery\n"},{"id":"146138","messageId":"AANLkTi=dgjoa8c=UN1VvMDgo_RAptTr1YFk+n_7M9sdM@mail.gmail.com","threadId":"24490","inReplyTo":"AANLkTi=82NDSfizCCjoJ-Sj05DzwXfa35ro60MiWSQdz@mail.gmail.com","subject":"Re: Git workflow with upstream repository","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2010-07-24T02:39:13Z","receivedAt":"2010-07-24T02:39:13Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Fri, Jul 23, 2010 at 9:43 PM, Bradley Wagner\n<bradley.wagner@hannonhill.com> wrote:\n> Thanks, I'll check those out! So, I take it there is not a way to get\n> a simple message like what git status tells you when you're local\n> branch is behind the remote branch:\n>\n> \"Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.\"\n\nAs far as I know, any given branch can only \"track\" one particular\nbranch, and that message is only generated relative to the branch\nyou're tracking.  You can adjust which one you're tracking by editing\n.git/config.\n\n> Is there even a concept of a fast-forward merge when pulling from a\n> remote repo that is not the remote to which your branches are\n> tracking?\n\nYes.  Tracking branches are really just a notational convenience.  In\nfact, they don't do very much more than generating the above message.\n(The other thing they do is make 'git pull' do something by default\nwhen you don't give it any other parameters.)\n\nYou might enjoy this article:\nhttp://eagain.net/articles/git-for-computer-scientists/\n\n> Is it possible to rebase based on a branch that is *not* the branch\n> you're currently tracking? Is that what the --onto flag is for?\n\nYes, it's possible.  The question of when you do or don't need the\n--onto option is a little more complex than that, but yes, that's\nwhat's it's for, more or less.\n\nHave fun,\n\nAvery\n"}]}