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

Re: [PATCH v2] git-clone: Add option --branch to override initial branch

From
Tor Arne Vestbø <torarnv@gmail.com>
Date
Mar 3, 2009, 16:47 UTC
Message-ID
<49AD5F0D.8000700@gmail.com>
In-Reply-To
<alpine.DEB.1.00.0903031004570.6399@intel-tinevez-2-302>
Johannes Schindelin wrote:
> Leaving unnecessary initialization and funny indentation aside for a 
> moment,

I do appreciate the feedback though. C is not my primary language, and I'm happy to learn from my mistakes :-)

> Keep in mind: your change (as every change) bears the potential to 
> introduce bugs and to complicate the user interface.  The change must be 
> worth those risks.
I fully understand. Here is my rationale for why it's worth the risk:

Imagine you have a project called Foo, which has active development on the 'master' branch, and not quite so active development on the more stable version branch '1.6' (which v1.6.0 and v1.6.1 was tagged from).

Now, you want to put up info on the project web page / wiki on how to contribute to project Foo. This information is for new contributors -- who may be unfamiliar with git and it's inner workings. You write:

"To get started contributing to project Foo, please clone using:
   $ git clone git://git.foo.com/project.git
"
This looks nice and inviting.

You also want to provide instructions for those who would like to contribute to the more stable branch of project Foo, 1.6:

"If you would like to contribute to the stable 1.6 branch, do:
   $ git clone -n git://git.foo.com/project.git
   $ cd project
   $ git checkout -t origin/1.6
   $ git branch -D master
"
Which is not so nice and inviting. At least not compared to:
"If you would like to contribute to the stable 1.6 branch, do:
   $ git clone git://git.foo.com/project.git --branch 1.6
"

Remember these are new contributors, unfamiliar with git. Presenting them with a list of four commands that have to be run to get started (commands which incidentally also are the first-ones new users mix up), is not ideal. "What does -n do?", "What does -t do?", "What's a tracking branch?", "Origin? What's that?", "What does -D do?", "Delete?! Will I delete the main development line!?", etc.. :)

Also, remember that these commands are not something that can be scripted or put into an alias, because these users have not cloned anything yet.

I know Subversions is perhaps not the best ideal, but to contrast:
   $ svn import http://svn.foo.bar/project/trunk
   $ svn import http://svn.foo.bar/project/branches/1.6

Easy to get to a different branch without having to dive into the full feature set of the SCM.

So, to conclude, I see this as a usability-feature of git-clone, which outweighs the possible risk of introducing new bugs. It's not a feature I will personally use that often, but it's one that I think new users will appreciate.

Tor Arne
Previous: Johannes SchindelinNext: Junio C Hamano
Message 7 of 19 in “git-clone: Add option --branch to override initial branch”
  1. git-clone: Add option --branch to override initial branchTor Arne Vestbø, Mar 2, 2009
  2. Johannes SchindelinMar 2, 2009
  3. Junio C HamanoMar 3, 2009
  4. Tor Arne VestbøMar 3, 2009
  5. git-clone: Add option --branch to override initial branchTor Arne Vestbø, Mar 3, 2009
  6. Johannes SchindelinMar 3, 2009
  7. Tor Arne VestbøMar 3, 2009
  8. Junio C HamanoMar 3, 2009
  9. Tor Arne VestbøMar 3, 2009
  10. Junio C HamanoMar 3, 2009
  11. Junio C HamanoMar 4, 2009
  12. Johannes SchindelinMar 4, 2009
  13. Tor Arne VestbøMar 4, 2009
  14. Paolo CiarrocchiMar 9, 2009
  15. Felipe ContrerasMar 9, 2009
  16. Paolo CiarrocchiMar 11, 2009
  17. Miles BaderMar 12, 2009
  18. Paolo CiarrocchiMar 12, 2009
  19. Felipe ContrerasMar 12, 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.