* git push won't push to a local branch
@ 2008-05-04 18:49 Geoffrey Irving
2008-05-04 19:19 ` Björn Steinbrink
0 siblings, 1 reply; 3+ messages in thread
From: Geoffrey Irving @ 2008-05-04 18:49 UTC (permalink / raw)
To: git
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
I can simulate the desired effect by switching to master and doing a pull.
% git checkout master
Switched to branch "master"
% git pull . local
Updating 0080774..7e8d678
Fast forward
scratch/pcomm.h | 146 -------------------------------------------------------
1 files changed, 0 insertions(+), 146 deletions(-)
delete mode 100644 scratch/pcomm.h
I'd prefer not to have to switch my checkout to master to accomplish
this, since I'll end up with a corrupted working copy if I push from
somewhere else to master at the same time (I want to avoid multiple
repository copies to save space).
Thanks,
Geoffrey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git push won't push to a local branch
2008-05-04 18:49 git push won't push to a local branch Geoffrey Irving
@ 2008-05-04 19:19 ` Björn Steinbrink
2008-05-04 20:00 ` Geoffrey Irving
0 siblings, 1 reply; 3+ messages in thread
From: Björn Steinbrink @ 2008-05-04 19:19 UTC (permalink / raw)
To: Geoffrey Irving; +Cc: git
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git push won't push to a local branch
2008-05-04 19:19 ` Björn Steinbrink
@ 2008-05-04 20:00 ` Geoffrey Irving
0 siblings, 0 replies; 3+ messages in thread
From: Geoffrey Irving @ 2008-05-04 20:00 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: git
On Sun, May 4, 2008 at 12:19 PM, Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-04 20:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04 18:49 git push won't push to a local branch Geoffrey Irving
2008-05-04 19:19 ` Björn Steinbrink
2008-05-04 20:00 ` Geoffrey Irving
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).