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

Re: pushing branches

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 21, 2012, 19:33 UTC
Message-ID
<7v7gtwucx7.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACnwZYdUzk74znPs4F+xz3haA3QhA9-DbR3mWWEVMfnztp-oCA@mail.gmail.com>
Thiago Farina <tfransosi@gmail.com> writes:
Show 5 quoted lines
> Do'h, now I can see the idiocy that I was doing.
>
> If I'm understanding this better,
> $ git push origin master
> tells git to push to remote origin, the contents of my master branch.

Yes, add "to the 'master' at the 'origin'" at the end of the sentence and you are perfect.

> And then,
>
> $ git push origin feature-work
> tells git to push to remote origin to push the contents of feature-work branch.
Yes.
> Hence does not make sense to ask git to do "push origin master" while
> inside feature-work branch.

No. As long as you know your master is ready and suitable to be published when you ask "push", the command perfectly makes sense; it does not matter on what branch you are on.

You may say
	$ git checkout master
        ... work work work ...
        $ make test
        ... ahh, perfection! ...
        $ git checkout -b feature
        ... let's build a bit more ..
        ... while I am having fun, let's not forget to push the
        ... part that is already solid out
        $ git push origin master

and that is perfectly fine without "git checkout master" before pushing (and "git checkout feature" after to come back to what you were doing).

Previous: Thiago FarinaNext: Thiago Farina
Message 8 of 13 in “pushing branches”
  1. Thiago FarinaJul 20, 2012
  2. Junio C HamanoJul 20, 2012
  3. Thiago FarinaJul 20, 2012
  4. PJ WeisbergJul 20, 2012
  5. Thiago FarinaJul 21, 2012
  6. PJ WeisbergJul 21, 2012
  7. Thiago FarinaJul 21, 2012
  8. Junio C HamanoJul 21, 2012
  9. Thiago FarinaJul 22, 2012
  10. Junio C HamanoJul 22, 2012
  11. PJ WeisbergJul 20, 2012
  12. Konstantin KhomoutovJul 20, 2012
  13. Matthieu MoyJul 20, 2012

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.