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

Re: Handling tags/branches after git-svn fetch during SVN to Git conversion

From
Jacob Helwig <jacob.helwig@gmail.com>
Date
Jul 9, 2010, 03:34 UTC
Message-ID
<AANLkTimDSO6CeClHlrLlFQbYbXOhSPJMUUn24nlmP1-8@mail.gmail.com>
In-Reply-To
<AANLkTilJ9tAO6Zf9whowApqhcpXU8Qvm31Z9RrQ3QaS6@mail.gmail.com>

On Thu, Jul 8, 2010 at 20:18, Bradley Wagner <bradley.wagner@hannonhill.com> wrote:

Show 6 quoted lines
> Thanks. Yea I was just looking at the man page trying to find the
> notation with the colon separated ref names.
>
> Is ":refs/heads/branch-foo" equivalent to just saying ":branch-foo" in
> the remote Git repo? Do I need the refs/heads piece?
>

That really depends on whether or not branch-foo already exists or not. From what I remember, if you use the <local>:<remote> syntax, then you need the refs/heads bit if the branch doesn't already exist.

> I'm trying to understand what a usual "git push origin branch-foo"
> equates to using your syntax.
>
It's equivalent to:
  git push origin refs/heads/branch-foo:refs/heads/branch-foo
  git push origin branch-foo:refs/heads/branch-foo
  # If branch-foo already exists on the remote end, it's also the same as:
  git push origin refs/heads/branch-foo:branch-foo
  git push origin branch-foo:branch-foo
Show 41 quoted lines
> On Thu, Jul 8, 2010 at 11:09 PM, Jacob Helwig <jacob.helwig@gmail.com> wrote:
>> remote2 would be the name of your remote repo, yes.
>>
>> origin/branch-foo would be equivalent to svn/branch-foo in your local
>> repo, if you did "git branch -a".  It should be the name of one of the
>> git-svn created branches.
>>
>> refs/heads/branch-foo is telling git where to store the reference for
>> the branch within remote2.  It does not need to exist already, and
>> should not in your case.
>>
>> The git-push man page has more in-depth explanations, if you're interested.
>>
>> On Thu, Jul 8, 2010 at 20:01, Bradley Wagner
>> <bradley.wagner@hannonhill.com> wrote:
>>> In your example, does "remote2" represent the name of my remote Git
>>> repo? What is "origin/branch-foo" and does the path
>>> "refs/heads/branch-foo" need to actually exist in my .git directory?
>>>
>>> On Thu, Jul 8, 2010 at 10:54 PM, Jacob Helwig <jacob.helwig@gmail.com> wrote:
>>>> On Wed, Jul 7, 2010 at 06:36, Bradley Wagner
>>>> <bradley.wagner@hannonhill.com> wrote:
>>>>> Do I need to convert these remote tags/branches into local Git
>>>>> tags/branches before pushing them to my remote Git repo or is there a
>>>>> way to push remote branches directly to my remote Git repo?
>>>>>
>>>>
>>>> You don't need to "convert" the branches to local ones.  git-push will
>>>> accept any ref your local repo knows about when you do a push.  For
>>>> example "git push remote2 origin/branch-foo:refs/heads/branch-foo"
>>>> works just fine, even if you don't have a "local" branch called
>>>> "branch-foo", and it will push the branch-foo branch out to the
>>>> remote2 remote repository.
>>>>
>>>> The tags, you'll need to convert to _actual_ tags, instead of just
>>>> branches under a tags/ namespace.  Unless you're fine with them
>>>> staying as pseudo-tags, then you can just push them out as you would
>>>> any other branch.
>>>>
>>>> -Jacob
>
Previous: Bradley Wagner
Message 7 of 7 in “Handling tags/branches after git-svn fetch during SVN to Git conversion”
  1. Bradley WagnerJul 7, 2010
  2. Bradley WagnerJul 9, 2010
  3. Jacob HelwigJul 9, 2010
  4. Bradley WagnerJul 9, 2010
  5. Jacob HelwigJul 9, 2010
  6. Bradley WagnerJul 9, 2010
  7. Jacob HelwigJul 9, 2010

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.