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

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

From
Tor Arne Vestbø <torarnv@gmail.com>
Date
Mar 3, 2009, 00:11 UTC
Message-ID
<49AC75AF.4080003@gmail.com>
In-Reply-To
<alpine.DEB.1.00.0903030047130.10279@pacific.mpi-cbg.de>
Johannes Schindelin wrote:
Show 8 quoted lines
> On Mon, 2 Mar 2009, Tor Arne Vestbø wrote:
>> The options --branch and -b allow the user to override the initial 
>> branch created and checked out by git-clone. Normally this is the active 
>> branch of the remote repository, which is also the fallback if the 
>> selected branch is not found.
> 
> I do not think that falling back if the selected branch is not found is a 
> wise choice.

Ah, was not sure what the proper response would be. I'll resubmit with a die() instead.

Show 6 quoted lines
> Besides, the common way to check out something different than the remote's 
> HEAD is like this:
> 
> 	$ git clone -n $URL
> 	$ cd $DIR
> 	$ git checkout -t origin/$BRANCH
Yepp, plus removing the original branch:
 $ git branch -D $ORIGINAL_ACTIVE_BRANCH # typically master
> I am undecided if that is good enough, or your patch is needed.

The idea was to be able to tell someone "hey, if you want to hack on some feature for next, do the following:"

 $ git clone git://git.kernel.org/pub/scm/git/git.git -b next

Maybe next is not such a good example, since it does not diverge that much from master and pu, but imagine a repository with a master, plus other branches that over time diverge from master (where you would typically use git-new-workdir to have them in a separate working tree).

In that situation it would be nice to be able to tell someone, hey, if you want to work on this odd branch which is not master, just do -b.

Tor Arne
Previous: Junio C HamanoNext: Tor Arne Vestbø
Message 4 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.