From: Jeff King Date: Tue, 25 Aug 2009 18:32:30 GMT Subject: Re: Confused about push/pull of a branch Message-ID: <20090825183230.GB23731@coredump.intra.peff.net> In-Reply-To: <8E2E19AE-DFA6-4000-AD73-35739F1E6642@uchicago.edu> On Tue, Aug 25, 2009 at 12:58:25PM -0500, Fritz Anderson wrote: > >I can't get a second machine to pull in a branch that's in my > >remote repository. I'm confused. > > And just from half-wittedly fooling around, I tried: > > machine_2$ git pull origin webservices That will merge the 'webservices' branch from your origin with your current branch (which looks like 'master' in this case). Remember that "pull" in git is really just "fetch" and "merge". What you want is "fetch" and "create a new local branch": $ git fetch $ git checkout -b webservices origin/webservices except that the "fetch" step has probably already been done as a side-effect of the pull you did earlier. > This seems to mean that master on machine_2 is now congruent to > webservices on machine_1. That's not what I meant. Is there a way to > undo this? git-pull origin-master doesn't seem to do anything. Sort of. It contains all the changes of 'master' _and_ all the changes of 'webservices'. However in this case there were no changes in 'master' that were not already in 'webservices', so we were able to "fast forward" to where webservices is. If the two branches had diverged at all, you would have had a merge (potentially with conflicts). To undo it, you probably want: $ git checkout master ;# make sure we are on master branch $ git reset --hard origin/master ;# go back to where remote master is -Peff