git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khomoutov <flatworm@users.sourceforge.net>
To: Thiago Farina <tfransosi@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: pushing branches
Date: Fri, 20 Jul 2012 19:49:05 +0400	[thread overview]
Message-ID: <20120720194905.9929a30ee42fd73cf62e7992@domain007.com> (raw)
In-Reply-To: <CACnwZYdqP_ptj0++dj5NkCoKWKHiLEj+c0t7zrmNidkHsyzMgw@mail.gmail.com>

On Fri, 20 Jul 2012 12:26:09 -0300
Thiago Farina <tfransosi@gmail.com> wrote:

> How can I push a working branch to github inside it?
> 
> E.g:
> 
> # On master:
> $ git checkout -b feature-work
> 
> # On feature-work
> # vi, hack, commit, ready to push
> $ git push origin master # here I expected it would working pushing my
> commits to a feature-work branch in github. Or if I omit master it
> gives me a [rejected] error.
$ git push origin master
means "update the branch 'master' in the remote repository with the
contents of the branch 'master' in the local repository".
Read the "git push" manual.

> $ git checkout master
> $ git push origin feature-work # Now the branch is pushed.
Sure, but it has nothing to do with the previous checkout command: you
just told Git to push the contents of your local branch "feature-work"
to a remote branch "feature-work" which presumably does not exist and
gets created as a result of your push.

If you want to update the remote "master" branch with the contents of
your local "feature-work" branch, do
$ git push origin feature-work:master

As stated below, you should really read the git push manual and reading
through the appropriate sections of the http://git-scm.com/book is also
highly advised.

Also consider reading about the "push.default" configuration variable
in the git config manual--this might save you from scratching your head
when you try to do simple `git push origin` without specifying any
branches: here again your expectation might differ from the Git
defaults.

  parent reply	other threads:[~2012-07-20 15:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 15:26 pushing branches Thiago Farina
2012-07-20 15:46 ` Junio C Hamano
2012-07-20 15:49   ` Thiago Farina
2012-07-20 19:19     ` PJ Weisberg
2012-07-21  1:40       ` Thiago Farina
2012-07-21  1:58         ` PJ Weisberg
2012-07-21  2:10           ` Thiago Farina
2012-07-21 19:33             ` Junio C Hamano
2012-07-22  2:54               ` Thiago Farina
2012-07-22 18:40                 ` Junio C Hamano
2012-07-20 15:46 ` PJ Weisberg
2012-07-20 15:49 ` Konstantin Khomoutov [this message]
2012-07-20 15:53 ` Matthieu Moy

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=20120720194905.9929a30ee42fd73cf62e7992@domain007.com \
    --to=flatworm@users.sourceforge.net \
    --cc=git@vger.kernel.org \
    --cc=tfransosi@gmail.com \
    /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).