threads / discuss / 10805

(unknown)

Subject: (unknown)

## tl;dr

5 messages between Nov 11, 2007 and Nov 12, 2007.

replies: 4people: 2as markdown or json

Michael Dressel· Nov 11, 2007, 13:08 UTC · lore
>Michael Dressel wrote:
>Ok nice. Another thing is that git-push will push all the tracking 
>branches in refs/remotes/origin. 

I learned that I only have to edit the .git/config file to avoid that git-push pushes everything.

I modified the remotes names and added push lines explicitly.
Is that the recommended way?
In my example (git-branch -a -v):
* exp                 aa854c6 shtest 4
  master              34924b9 mastertest 1
  origin/exp          aa854c6 shtest 4
  origin/master       b68e7a9 brt master 1
I used the following .git/config:
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin1"]
        url = /home/repo/src
        fetch = +refs/heads/master:refs/remotes/origin/master
        push = +refs/heads/master:refs/heads/master
[remote "origin2"]
        url = /home/repo/src
        fetch = +refs/heads/exp:refs/remotes/origin/exp
        push = +refs/heads/exp:refs/heads/exp
[branch "master"]
        remote = origin1
        merge = refs/heads/master
[branch "exp"]
        remote = origin2
        merge = refs/heads/exp

Cheers, Michael

Johannes Schindelin· Nov 11, 2007, 15:22 UTC · re: Michael Dressel · lore

Re: (no subject)

Hi,
On Sun, 11 Nov 2007, Michael Dressel wrote:
Show 7 quoted lines
> 
> >Michael Dressel wrote:
> >Ok nice. Another thing is that git-push will push all the tracking 
> >branches in refs/remotes/origin. 
> 
> I learned that I only have to edit the .git/config file to avoid that 
> git-push pushes everything. 
It is documented that you can use "git push origin <branchname>".
> [remote "origin1"]
>         url = /home/repo/src
>         fetch = +refs/heads/master:refs/remotes/origin/master
>         push = +refs/heads/master:refs/heads/master
With "push", it is not necessary to specify the ":<target>".

Also, if "master" is unambiguous, you can write just "master" instead of "refs/heads/master".

Furthermore, I suggest not forcing (that's what "+" does) the push, since it is quite possible that you push something old in the wrong direction.

Hth, Dscho

MichaelTiloDressel@t-online.de· Nov 12, 2007, 08:00 UTC · re: Johannes Schindelin · lore

Re: cogito remote branch

(I forgot to put the subject previously)
> Johannes Schindelin wrote:
>Hi,
>On Sun, 11 Nov 2007, Michael Dressel wrote:
Show 6 quoted lines
>> 
>> >Michael Dressel wrote:
>> >Ok nice. Another thing is that git-push will push all the tracking 
>> >branches in refs/remotes/origin. 
>> 
>> I learned that I only have to edit the .git/config file to avoid that
>> git-push pushes everything. 
>It is documented that you can use "git push origin ".
>> [remote "origin1"]
>>         url = /home/repo/src
>>         fetch = +refs/heads/master:refs/remotes/origin/master
>>         push = +refs/heads/master:refs/heads/master
>With "push", it is not necessary to specify the ":".
So just a line like
             push = master

A push is needed somewhere in order to prevent every remote to be pushed by default, right?

>Also, if "master" is unambiguous, you can write just "master" instead
of 
>"refs/heads/master".
>Furthermore, I suggest not forcing (that's  what "+" does) the push,
since 
>it is quite possible that you push something old in the wrong
direction.  
O.k. I will reconsider this.

Cheers, Michael

Johannes Schindelin· Nov 12, 2007, 09:55 UTC · re: MichaelTiloDressel@t-online.de · lore

Re: cogito remote branch

Hi,
On Mon, 12 Nov 2007, MichaelTiloDressel@t-online.de wrote:
> So just a line like
>              push = master
Exactly.
> A push is needed somewhere in order to prevent every remote to be pushed 
> by default, right?

You mean a "push" config variable? No. I think I mentioned in my first reply that

	git push <remote> <branch>...
works quite wonderfully.

Hth, Dscho

MichaelTiloDressel@t-online.de· Nov 12, 2007, 10:47 UTC · re: Johannes Schindelin · lore

Re: cogito remote branch

Johannes Schindelin wrote:
>> A push is needed somewhere in order to prevent every remote to be
pushed 
>> by default, right?
>You mean a "push" config variable?  No.  I think I mentioned in my
first 
>reply that
>	git push  <remote> <branch>...
>works quite wonderfully.

I mean a push = .. line in the [remote <name>] block. And if there is such a line than git-push without arguments will push only the current branch. For me that is nice, because if I forgot to give an argument to git-push it will not push other branches.

If there is no such line all the remotes (that don't have a push line?) get pushed.

Cheers, Michael

← back to recent threads