git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: More help with "pull" please

From
Tomas Carnecky <tom@dbservice.com>
Date
Apr 1, 2009, 20:15 UTC
Message-ID
<4659A860-4AF5-4E34-B38E-60C926E2BAE1@dbservice.com>
In-Reply-To
<450196A1AAAE4B42A00A8B27A59278E70A7D4D9A@EXCHANGE.trad.tradestation.com>
On Apr 1, 2009, at 9:28 PM, John Dlugosz wrote:
Show 12 quoted lines
> 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'
Show 22 quoted lines
> 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
Previous: John DlugoszNext: John Dlugosz
Message 2 of 8 in “More help with "pull" please”
  1. John DlugoszApr 1, 2009
  2. Tomas CarneckyApr 1, 2009
  3. John DlugoszApr 1, 2009
  4. Tomas CarneckyApr 1, 2009
  5. John DlugoszApr 1, 2009
  6. Junio C HamanoApr 2, 2009
  7. John DlugoszApr 2, 2009
  8. Tomas CarneckyApr 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.