Re: Confused about push/pull of a branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 25, 2009 at 12:40:47PM -0500, Fritz Anderson wrote:

> Branch webservices was created after the working copy on machine_2
> was cloned.
> 
> In my working copy on machine_2:
> 
> machine_2$ git pull
> Password:
> # Progress messages, no protests.
> machine_2$ git checkout webservices
> error: pathspec 'webservices' did not match any file(s) known to git.
> machine_2$ git branch
> * master
> machine_2$

Try "git branch -a", which will list remote branches. You likely have a
remote tracking branch "origin/webservices". You can check that out to
examine it, or if you want to start working on it locally, try "git
checkout -b webservices origin/webservices".

> git-config shows the two repository URLs are identical, net of
> machine_2 having to specify a user name and host. The machine_2 .git/
> config shows a section for [branch "master"], but not for
> webservices. Is that the problem? What's the approved way of adding

> [branch "webservices"], and what do I put into it?

The branch.webservices config is not necessary for a branch; it just
says "by the way, when you do a pull without arguments and we are on
this branch, here is where to pull from". Doing the "checkout -b" above
will create such a config section on recent versions of git.

> I've obviously forgotten something. Or never understood something
> (there's a lot in Git not to understand). How do I get the
> webservices branch onto machine_2, so I can check it out?

The branching model in git is a little different than other systems.
Just because the remote has a branch does not mean _you_ have a branch.
When you fetch from them (or pull, which does a fetch behind the
scenes), you will have a "remote tracking branch" which is your local
copy of where their remote branches are. You still need to create your
own local branch if you want to do work on it (and bear in mind your
branch doesn't need the same name or to be related in any long term way;
you are merely using their remote branch as a starting point for your
branch).

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]