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

Re: git pull and merging.

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 6, 2006, 09:31 UTC
Message-ID
<el62hi$esu$1@sea.gmane.org>
In-Reply-To
<cc723f590612052121u1f6e3c9lc7329f40ee1c9e5a@mail.gmail.com>
Aneesh Kumar wrote:
Show 18 quoted lines
> On 12/6/06, Junio C Hamano <junkio@cox.net> wrote:
>> "Aneesh Kumar" <aneesh.kumar@gmail.com> writes:
>>
>>> I have a git.git clone using --use-separate-remote. That means i have
>>> the master branch created by default. Now i need to build git from the
>>> pu branch too. So i created git branch pu remotes/origin/pu.
>>>
>>>
>>> How how do i track the pu branch using git pull. What i mean is the
>>> master local branch is tracked by default using git pull. Is there a
>>> way to track the local pu branch too.
>>
>>         $ cat>.git/remotes/origin <<\EOF
>>         URL: ...kernel.org/pub/scm/git/git.git
>>         Pull: refs/heads/master:refs/remotes/origin/master
>>         Pull: refs/heads/next:refs/remotes/origin/next
>>         Pull: +refs/heads/pu:refs/remotes/origin/pu
>>         EOF
Or you can do .git/config equivalent:

$ git repo-config remote.origin.url ...kernel.org/pub/scm/git/git.git $ git repo-config remote.origin.fetch refs/heads/master:refs/remotes/origin/master $ git repo-config remote.origin.fetch refs/heads/next:refs/remotes/origin/next $ git repo-config remote.origin.fetch +refs/heads/pu:refs/remotes/origin/pu

Show 31 quoted lines
>> Then you would checkout 'pu' by having a matching local branch:
>>
>>         $ git branch pu remotes/origin/pu
>>         $ git checkout pu ;# this is your refs/heads/pu
>>         $ make
>>
>> Hacking on it can be done in this branch as usual.  When you are
>> interested in the latest 'pu' from me:
>>
>>         $ git checkout pu ;# this is your refs/heads/pu
>>         $ git fetch ;# most of the time git pull would also be fine...
>>
>> and then:
>>
>>         $ git rebase remotes/origin/pu
>>
>> The 'rebase' in the last step is because my 'pu' rewinds freely;
>> otherwise you would do "git merge remotes/origin/pu" instead.
>>
> 
> Okey what i was looking for was a .git/config that will imply as a
> part of git pull origin that local
> 
> master is to track remotes/origin/master
> pu  should track remotes/origin/pu.
> 
> I almost felt the branch.<name>.merge was for that.
> 
> What is this git-repo-config used for. I am trying to understand
> 
> branch.<name>.remote and branch.<name>.merge usage.

Yes it is what branch.<name>.merge is for... and it would work for any branch _except_ pu, which rewinds frequently, and you should rebase your changes on top of current version instead of merging.

Still it is useful to add branch.<branch>.remote for pu:
  $ git repo-config branch.refs/heads/pu.remote origin

so you can do just "git fetch" on pu to fetch from origin (well, "git fetch" would fetch from origin as it is the default even in absence of branch.<branch>.remote).

If it were any other branch, for example next, you could add
  $ git repo-config branch.refs/heads/next.remote origin
  $ git repo-config branch.refs/heads/next.merge refs/remotes/origin/next

for "git pull" on next branch fo fetch from origin and merge next branch from origin.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Jakub NarebskiNext: Johannes Schindelin
Message 34 of 36 in “git pull and merging.”
  1. Aneesh KumarDec 6, 2006
  2. Junio C HamanoDec 6, 2006
  3. Aneesh KumarDec 6, 2006
  4. Johannes SchindelinDec 6, 2006
  5. Peter BaumannDec 6, 2006
  6. Johannes SchindelinDec 6, 2006
  7. Peter BaumannDec 6, 2006
  8. Aneesh KumarDec 6, 2006
  9. Jakub NarebskiDec 6, 2006
  10. Josef WeidendorferDec 6, 2006
  11. Aneesh Kumar K.VDec 7, 2006
  12. Josef WeidendorferDec 7, 2006
  13. Junio C HamanoDec 7, 2006
  14. Josef WeidendorferDec 7, 2006
  15. Santi BéjarDec 8, 2006
  16. Josef WeidendorferDec 8, 2006
  17. Add branch.*.localmerge and documentation updateJosef Weidendorfer, Dec 8, 2006
  18. Santi BéjarDec 8, 2006
  19. Junio C HamanoDec 8, 2006
  20. Jakub NarebskiDec 8, 2006
  21. Josef WeidendorferDec 8, 2006
  22. Junio C HamanoDec 8, 2006
  23. Josef WeidendorferDec 8, 2006
  24. Junio C HamanoDec 8, 2006
  25. Add branch.*.merge warning and documentation updateJosef Weidendorfer, Dec 9, 2006
  26. Santi BéjarDec 9, 2006
  27. Josef WeidendorferDec 8, 2006
  28. Santi BéjarDec 8, 2006
  29. Santi BéjarDec 8, 2006
  30. Junio C HamanoDec 8, 2006
  31. Junio C HamanoDec 7, 2006
  32. Santi BéjarDec 8, 2006
  33. Jakub NarebskiDec 8, 2006
  34. Jakub NarebskiDec 6, 2006
  35. Johannes SchindelinDec 6, 2006
  36. Fwd: git pull and merging.Aneesh Kumar, Dec 6, 2006

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.