Re: More help with "pull" please

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

 




On Apr 1, 2009, at 9:28 PM, John Dlugosz wrote:

I've actually given up on using "git pull" at all, preferring to fetch
first, examine in gitk, and then decide whether to merge or whatever.

The problem I have is that it seems to always want to merge "something"
with the current checked-out branch.  It always throws the remote HEAD
into the mix, or if fetch lines are set up in the configuration file,
takes the first thing on there regardless of which branch I'm currently checked out. Maybe I'm wrong, but I just re-read the man page, forward
and backwards, and am more bewildered than ever.

When you create a branch, you can tell git which remote branch it tracks, like this:

$ git branch --track mynext origin/next

So whenever you are on brach 'mynext' and do a git-pull, it will fetch and merge origin/next.

You can do the same with the git-checkout command:

$ git checkout --track origin/next

This will create a local branch 'next' which tracks 'origin/next'

Anyway, I want to help out a co-worker who has a more specialized
situation that may be right for a pull.  Also, I'll talk him through
cloning the remote from the beginning, so the config files won't be all
strange or not setup from the previous users.

The only remaining issue is the remote in question:  it is not a bare
repository, and may be in use locally as well, at least for maintenance.
So I can't trust its HEAD to be anything reasonable at any given time.

This person wants to track a remote branch tip.  When that advances or
otherwise changes on the remote, update the working tree to match.  It
will always use the same branch, let's call it ReleaseCandidate for this
discussion.

My question is: What is the easiest way to create this local repository and operate it so that he can just keep it following that branch on the
remote?

$ git clone $url XXX
$ cd XXX
$ git checkout --trach origin/ReleaseCandidate
...
$ git pull # will automatically fetch and merge origin/ReleaseCandidate

tom

--
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]

  Powered by Linux