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

Re: Difficulties in advertising a new branch to git newbies

From
SBSanti Béjar <sbejar@gmail.com>
Date
Feb 1, 2007, 09:02 UTC
Message-ID
<8aa486160702010102q3a49c4cfle44379a5f0b5422d@mail.gmail.com>
In-Reply-To
<200702010120.58806.Josef.Weidendorfer@gmx.de>
On 2/1/07, Josef Weidendorfer <Josef.Weidendorfer@gmx.de> wrote:
Show 10 quoted lines
> On Wednesday 31 January 2007, Carl Worth wrote:
> > > It would be nice if:
> > >
> > > git clone -b ${branch} git://...
>
> Nice indeed.
>
> Additionally, it would be nice for clone to directly
> checkout tags. Why not an option "--checkout <ref>"
> to directly checkout <ref> after cloning?
Maybe, I'm not sure.
Show 11 quoted lines
> > In addition, it would be great to have a command that did the same
> > setup within an existing repository.
>
> Why not use "git clone" for this?
> Currently, the man page says about the directory it will clone into:
>
>  "Cloning into an existing directory is not allowed."
>
> But we could relax this: if the specified directory is the root of
> a checkout (ie. with a .git subdir), we would clone a remote repository
> into the same local repository.

You can do it with git-remote. I think it is sensible to have a command to get a new repository and a command to have a new remote.

For the "work on the non-HEAD branch" I think we could have:

# clone a remote repository and start working with branch ${branch} $ git clone -b ${branch} ${url}

# add a new branch based on a remote branch, # and configure to pull from there. $ git branch ${branch} ${remote_branch} $ git checkout -b ${branch} ${remote_branch}

as you see it is the current syntax, so I suggest to automatically setup the branch.${branch}.{remote,merge} configs to follow the ${remote_branch} if this is sensible. So for example

$ git clone ${url_of_git.git} $ cd git $ git checkout -b maint origin/maint $ git-config -l | grep ^branch.maint branch.master.remote=origin branch.master.merge=refs/heads/maint

( or branch.master.merge=refs/remotes/origin/maint )

This changes the current behaviour, but I think it make sense. If this is not possible another way would be to have another option (-r for remote, or -f for follow, or -p for pull, or -m for merge, ...) as:

$ git branch ${branch} -r ${remote_branch} $ git checkout -b ${branch} -r ${remote_branch}

And if you want to add/change the remote/merge config for an existing branch, in addition to doing this with git-config, git-remote could do it as it currently shows the tracking branches.

Santi
Previous: Josef WeidendorferNext: Jakub Narebski
Message 37 of 50 in “Difficulties in advertising a new branch to git newbies”
  1. Carl WorthJan 30, 2007
  2. Jakub NarebskiJan 30, 2007
  3. Yann DirsonJan 30, 2007
  4. Jakub NarebskiJan 30, 2007
  5. Junio C HamanoJan 30, 2007
  6. Jakub NarebskiJan 30, 2007
  7. Matthias LederhoferJan 30, 2007
  8. Matthias LederhoferJan 30, 2007
  9. Jeff KingJan 30, 2007
  10. Junio C HamanoJan 31, 2007
  11. Nicolas PitreJan 31, 2007
  12. Jeff KingJan 31, 2007
  13. Nicolas PitreJan 31, 2007
  14. Jeff KingJan 31, 2007
  15. Nicolas PitreJan 31, 2007
  16. Jeff KingJan 31, 2007
  17. Junio C HamanoJan 31, 2007
  18. Theodore TsoJan 31, 2007
  19. Junio C HamanoJan 31, 2007
  20. Jakub NarebskiJan 31, 2007
  21. Nicolas PitreJan 31, 2007
  22. Daniel BarkalowJan 31, 2007
  23. Nicolas PitreJan 31, 2007
  24. Daniel BarkalowJan 31, 2007
  25. Nicolas PitreJan 31, 2007
  26. J. Bruce FieldsJan 31, 2007
  27. Jakub NarebskiJan 31, 2007
  28. Nicolas PitreJan 31, 2007
  29. Daniel BarkalowJan 31, 2007
  30. Nicolas PitreJan 31, 2007
  31. Guilhem BonnefilleJan 31, 2007
  32. Carl WorthJan 31, 2007
  33. Johannes SchindelinJan 31, 2007
  34. Santi BéjarJan 31, 2007
  35. Carl WorthJan 31, 2007
  36. Josef WeidendorferFeb 1, 2007
  37. Santi BéjarFeb 1, 2007
  38. Jakub NarebskiFeb 1, 2007
  39. Carl WorthFeb 6, 2007
  40. Junio C HamanoFeb 6, 2007
  41. Junio C HamanoFeb 6, 2007
  42. Jeff KingFeb 6, 2007
  43. Carl WorthFeb 6, 2007
  44. Junio C HamanoFeb 6, 2007
  45. Carl WorthFeb 6, 2007
  46. Jakub NarebskiFeb 6, 2007
  47. Jeff KingFeb 6, 2007
  48. Junio C HamanoFeb 6, 2007
  49. Jeff KingFeb 6, 2007
  50. Nicolas PitreFeb 6, 2007

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.