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

Re: git push won't push to a local branch

From
Geoffrey Irving <irving@naml.us>
Date
May 4, 2008, 20:00 UTC
Message-ID
<7f9d599f0805041300h4c541082h7d78625707dbf124@mail.gmail.com>
In-Reply-To
<20080504191936.GA3119@atjola.homenet>
On Sun, May 4, 2008 at 12:19 PM, Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
Show 26 quoted lines
> On 2008.05.04 11:49:38 -0700, Geoffrey Irving wrote:
>  > Hello,
>  >
>  > There's an asymmetry between push and pull that seems unnecessary:
>  > pull can pull from local branches, but push can't push to them.  Is
>  > there a reason for this asymmetry?
>  >
>  > In more detail, if I have a working copy with two branches, local and
>  > master, I can use git pull to pull changes from master to local:
>  >
>  > % git checkout local
>  > % git pull . master
>  > ... pulls changes from master to local branch
>  >
>  > If I make a change in local and try to do the reverse with git push,
>  > it gives a confusing non-error message and doesn't do anything:
>  >
>  > % git checkout local
>  > % git rm scratch/pcomm.h
>  > % git commit
>  > % git push . master
>  > Everything up-to-date
>
>  You're pushing master to master ;-) Try "git push . local:master".
>
>  Björn

Yep, that works. I'll remember to use -v next time I don't know what's going on.

Is there a reason for the syntax asymmetry? If git pull defaults to pulling into my current branch, why does git push default to uselessly pushing and pulling to the same branch?

Also, can I make a bare "git push" default to "git push . local:master"?
Geoffrey
Previous: Björn Steinbrink
Message 3 of 3 in “git push won't push to a local branch”
  1. Geoffrey IrvingMay 4, 2008
  2. Björn SteinbrinkMay 4, 2008
  3. Geoffrey IrvingMay 4, 2008

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.