Git development
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Lasse Kliemann <lasse-gmane-git-2009@mail.plastictree.net>
Cc: git@vger.kernel.org
Subject: Re: git-push: creating branch on remote, refspec format
Date: Thu, 26 Feb 2009 13:08:29 +0100	[thread overview]
Message-ID: <49A6863D.9000900@drmicha.warpmail.net> (raw)
In-Reply-To: <go609m$3dj$2@ger.gmane.org>

Lasse Kliemann venit, vidit, dixit 26.02.2009 13:00:
> http://www.kernel.org/pub/software/scm/git/docs/git-push.html reads:
> 
> | git push origin master:refs/heads/experimental
> | 
> |   Create the branch experimental in the origin repository by copying the 
> |   current master branch. This form is only needed to create a new branch or 
> |   tag in the remote repository when the local name and the remote name are 
> |   different; otherwise, the ref name on its own will work.
> 
> It appears to me that the ref name on its own will also work to create a new 
> branch, at least with local repositories:
> 
> $ (mkdir a && cd a && git init)
> Initialized empty Git repository in /tmp/a/.git/
> $ mkdir b && cd b && git init
> Initialized empty Git repository in /tmp/b/.git/
> $ pwd
> /tmp/b
> $ touch x && git add x && git commit 
> [master (root-commit)]: created 87a90f5: "NA"
>  0 files changed, 0 insertions(+), 0 deletions(-)
>  create mode 100644 x
> 
> Now the push from '/tmp/b' to '/tmp/a':
> 
> $ git push /tmp/a master:foo
> Counting objects: 3, done.
> Writing objects: 100% (3/3), 209 bytes, done.
> Total 3 (delta 0), reused 0 (delta 0)
> Unpacking objects: 100% (3/3), done.
> To /tmp/a
>  * [new branch]      master -> foo
> 
> Am I missing something?
> 

You're using the very same form as the doc. "This form" in the doc
refers to "repo refspec", i.e. something like "a b:c", which is what you
use. The "refs/heads/" part is just there to disambiguate between
possible different matches on the remote side (refs/heads/foo,
refs/tags/foo, refs/remotes/bar/foo, ...).

Michael

  reply	other threads:[~2009-02-26 12:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26 12:00 git-push: creating branch on remote, refspec format Lasse Kliemann
2009-02-26 12:08 ` Michael J Gruber [this message]
2009-02-26 13:18   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49A6863D.9000900@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=lasse-gmane-git-2009@mail.plastictree.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox