git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: 'Johannes Schindelin' <Johannes.Schindelin@gmx.de>,
	'Steffen Prohaska' <prohaska@zib.de>, 'git' <git@vger.kernel.org>
Subject: Re: git push bug?
Date: Sat, 20 Oct 2007 14:05:43 +0200	[thread overview]
Message-ID: <20071020120543.GA19521@efreet.light.src> (raw)
In-Reply-To: <000001c81280$ebc5c5e0$5267a8c0@Jocke>

[-- Attachment #1: Type: text/plain, Size: 2743 bytes --]

On Fri, Oct 19, 2007 at 20:50:29 +0200, Joakim Tjernlund wrote:
> On den 19 oktober 2007 19:25, Johannes Schindelin [mailto:Johannes.Schindelin@gmx.de] wrote:
> > It strikes me as really odd that you would _want_ to create a branch 
> > remotely, that has _never_ existed locally.
> It strikes me as really odd that a core developers like yourself
> hasn't tried to justify/explain why push works as it does.

Dscho it rarely kind to newbies.

> As I am trying to convince our dev. group here to move to git instead of subversion, I
> need to learn how git works. Now I have gotten to the push function and I need
> to know what can be done with push and how, pitfalls too. As I go along I find behavior
> that I find odd and report these to the list.
> 
>  git push <repo> v2.6.23:refs/heads/linus
> will make a tag look like a branch

That's becasue tags come in two flavors -- annotated and unannotated.
Annotated ones don't point to commits directly, but via 'tag' objects, that
contain description and usually signature.

Now git push will simply assign a remote branch whatever value you give it.
You gave it a tag, so it assigned a tag.

>  git push <repo> linus:linus
> won't let me create the remote branch linus but
>  git push <repo> linus
> will

Because in the former you are not saying whether refs/heads/linus,
refs/tags/linus or something else (the fact that heads and tags are treated
specially by git does not mean refs can't have other subdirectories -- it
can).

On the other hand in the later it resolves the ref locally and uses the same
name remotedly.

>  git push <repo> :linus
> OOPS, now I just deleted remote branch linus, no warning

Your commands are quite obvious. No need for warning. (Besides, isn't there
a reflog?)

>  git push <repo> linus:refs/head/linus
> creates a branch that is invisible(wont show in git branch -a)

It does not create a branch. It creates a ref with slightly funny name (it's
refs/heads, not refs/head).
         ^

>  git push <repo> linus:refs/heads/newbranch
> creates remote branch newbranch, but you have to know the magic words
> refs/heads/ to do it.

Because you could have wanted a tag. Or a remote. Or something completely
different, maybe because some add-on uses (eg. stgit uses refs/bases and
refs/patches, IIRC).

> Se what I mean? 

To me it all looks perfectly consistent. But maybe the documentation should
state more clearly, that push works in terms of arbitrary refs, NOT branches.
Feel free to post a documentation patch (people who just had hard time
finding something out are usually better at explaining it than old-timers who
consider it obvious).

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2007-10-20 12:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18 14:50 git push bug? Joakim Tjernlund
2007-10-18 15:14 ` Steffen Prohaska
2007-10-18 16:01   ` Joakim Tjernlund
2007-10-18 16:10     ` Joakim Tjernlund
2007-10-19  0:49       ` Shawn O. Pearce
2007-10-18 16:13     ` Steffen Prohaska
2007-10-18 16:21     ` Johannes Schindelin
2007-10-18 16:31       ` Joakim Tjernlund
2007-10-18 22:00         ` Johannes Schindelin
2007-10-19 14:47           ` Joakim Tjernlund
2007-10-19 17:24             ` Johannes Schindelin
2007-10-19 18:50               ` Joakim Tjernlund
2007-10-19 22:46                 ` Johannes Schindelin
2007-10-20 12:05                 ` Jan Hudec [this message]
2007-10-18 16:55       ` Steffen Prohaska
2007-10-18 21:58         ` Johannes Schindelin
2007-10-20  8:29           ` Steffen Prohaska
2007-10-20  8:38             ` Steffen Prohaska
2007-10-20 11:52             ` Joakim Tjernlund
2007-10-19  0:24   ` Shawn O. Pearce
2007-10-20 17:38     ` Joakim Tjernlund

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=20071020120543.GA19521@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=joakim.tjernlund@transmode.se \
    --cc=prohaska@zib.de \
    /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;
as well as URLs for NNTP newsgroup(s).