login
Header Space

 
 

Friendly refspecs (Was: Re: git annoyances)

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff King <peff@...>
Cc: Ingo Molnar <mingo@...>, <git@...>
Date: Wednesday, April 9, 2008 - 4:08 pm

Jeff King wrote (2008-04-09 10:57 -0400):


I have found this refs/heads/*:refs/remotes/* stuff quite confusing, but
I'm starting to understand them. I know my way with them but still they
seem quite unnecessary hackerish. Pull and push work pretty nicely
without knowing about any refs/* stuff; they can be operated with simple
branch names. Fetch is another story. Some ideas:

  $ git fetch <URL>

would be equivalent to

  $ git fetch <URL> +refs/heads/*:refs/remotes/<name>/*

In other words, fetch all the branches from remote repo and store them
locally as remote tracking branches to <name>/ hieararchy. The <name> is
the last component taken from the <URL> (maybe "origin" if it can't be
detected). 

Currently "git fetch <URL>" does not seem to do anything useful for
non-git-hackers. It seems to fetch objects but not create any branches
referring to them. As a comparison, let's configure a remote and run
similar fetch command without any refspecs explicitly named:

  $ git remote add <name> <URL>
  $ git fetch <name>

Now this fetch really creates all the branches (as defined in
remote.<name>.fetch) which is nice and the way Git currently works.

So would it be any good if "git fetch <URL>" without refpecs would use
+refs/heads/*:refs/remotes/<name>/* ? In any case the current behaviour
seems quite unfriendly.

Some more ideas for simple refspecs:

  $ git fetch <URL|name> <branch>

would be equivalent to

  $ git fetch <URL|name> +refs/heads/<branch>:refs/remotes/<name>/<branch>

Again the same behaviour with <URL> and configured remote <name>. In the
<URL> case the <name> is the last component of the <URL>.

  $ git fetch <URL|name> <Rbranch>:<Lbranch>

would be equivalent to

  $ git fetch <URL|name> +refs/heads/<Rbranch>:refs/remotes/<Lbranch>

Note that by giving the destination branch (the right side of colon) the
new remote tracking branch would be created directly to the
refs/remotes/ hierarchy, not to refs/remotes/<name>/ hierarchy like in
previous examples. This lets user a bit more control as she decided to
give <Lbranch> explicitly. User may want to give refspec
master:<name>/master to have new branch created as
refs/remotes/<name>/master.

With above example commands it is not possible to fetch remote branches
and store refs locally to refs/heads/ hierarchy. For this it would
either need another step - "git branch my-branch <name>/master" - or use
the long refspec form with fetch:
+refs/heads/master:refs/heads/my-branch .

Does this sound any good?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git annoyances, Ingo Molnar, (Wed Apr 9, 6:14 am)
Re: git annoyances, Daniel Barkalow, (Wed Apr 9, 3:21 pm)
Re: git annoyances, Ingo Molnar, (Wed Apr 9, 4:41 pm)
Re: git annoyances, Daniel Barkalow, (Thu Apr 10, 10:08 am)
Re: git annoyances, Junio C Hamano, (Wed Apr 9, 5:04 pm)
Re: git annoyances, André Goddard Rosa, (Wed Apr 9, 7:56 pm)
Re: git annoyances, Govind Salinas, (Thu Apr 10, 3:45 pm)
Re: git annoyances, Jean-Christian de Rivaz, (Thu Apr 10, 2:08 am)
Re: git annoyances, Sverre Rabbelier, (Thu Apr 10, 4:19 am)
Re: git annoyances, Jon Loeliger, (Wed Apr 9, 5:39 pm)
Re: git annoyances, Nicolas Pitre, (Wed Apr 9, 7:45 pm)
Re: git annoyances, Jeff King, (Wed Apr 9, 5:45 pm)
Re: git annoyances, Luciano Rocha, (Fri Apr 11, 6:15 am)
Re: git annoyances, Wincent Colaiuta, (Fri Apr 11, 6:27 am)
git-bisect annoyances, Ingo Molnar, (Thu Apr 10, 7:47 am)
Re: git-bisect annoyances, Junio C Hamano, (Fri Apr 11, 1:56 am)
Re: git-bisect annoyances, Christian Couder, (Fri Apr 11, 1:41 am)
Re: git-bisect annoyances, Ingo Molnar, (Fri Apr 11, 7:41 am)
Re: git-bisect annoyances, Christian Couder, (Sat Apr 12, 2:56 am)
Re: git annoyances, Jeff King, (Wed Apr 9, 10:57 am)
Re: git annoyances, Avery Pennarun, (Wed Apr 9, 1:08 pm)
Re: git annoyances, Karl , (Thu Apr 10, 4:41 am)
Re: git annoyances, Avery Pennarun, (Thu Apr 10, 11:05 am)
Re: git annoyances, Karl , (Fri Apr 11, 3:00 am)
Friendly refspecs (Was: Re: git annoyances), Teemu Likonen, (Wed Apr 9, 4:08 pm)
Re: Friendly refspecs, Junio C Hamano, (Wed Apr 9, 5:21 pm)
Re: Friendly refspecs, Teemu Likonen, (Thu Apr 10, 3:38 am)
Re: Friendly refspecs (Was: Re: git annoyances), Avery Pennarun, (Wed Apr 9, 4:32 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 4:34 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Teemu Likonen, (Wed Apr 9, 6:25 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 6:51 pm)
Re: Friendly refspecs, Teemu Likonen, (Sun Apr 13, 5:31 am)
Re: Friendly refspecs, Jeff King, (Tue Apr 15, 11:48 pm)
Re: Friendly refspecs, Daniel Barkalow, (Wed Apr 16, 11:42 am)
Re: Friendly refspecs, Junio C Hamano, (Wed Apr 16, 12:41 am)
Re: Friendly refspecs, Jeff King, (Wed Apr 16, 12:47 am)
Re: Friendly refspecs, Jeff King, (Wed Apr 16, 12:25 am)
[PATCH] Add examples section to 'git fetch' manual, Teemu Likonen, (Sun Apr 13, 5:34 am)
Re: [PATCH] Add examples section to 'git fetch' manual, Junio C Hamano, (Sun Apr 13, 2:56 pm)
Re: [PATCH] Add examples section to 'git fetch' manual, Teemu Likonen, (Sun Apr 13, 4:05 pm)
Re: [PATCH] Add examples section to 'git fetch' manual, Junio C Hamano, (Sun Apr 13, 9:02 pm)
Re: [PATCH] Add examples section to 'git fetch' manual, Matt Graham, (Sun Apr 13, 3:48 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 8:03 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 8:11 pm)
Re: Friendly refspecs, Junio C Hamano, (Thu Apr 10, 3:51 am)
Re: Friendly refspecs, Jeff King, (Thu Apr 10, 4:03 am)
Re: [PATCH] git-remote: show all remotes with "git remote sh..., Johannes Schindelin, (Wed Apr 9, 12:54 pm)
Re: git annoyances, Björn, (Wed Apr 9, 6:41 am)
Re: [PATCH] When a remote is added but not fetched, tell the..., Johannes Schindelin, (Fri Apr 11, 11:21 am)
Re: [PATCH] Default to fetching a remote after adding it., Wincent Colaiuta, (Fri Apr 11, 3:36 pm)
Re: [PATCH] Default to fetching a remote after adding it., Johannes Schindelin, (Sat Apr 12, 10:33 am)
Re: [PATCH] Default to fetching a remote after adding it., Johannes Schindelin, (Sat Apr 12, 11:24 am)
Re: [PATCH] Default to fetching a remote after adding it., Stephen Sinclair, (Fri Apr 11, 3:17 pm)
speck-geostationary