Not pushing all branches?

14 messages, 8 authors, 2016-06-15 · open the first message on its own page

Not pushing all branches?

From: Peter Krefting <hidden>
Date: 2016-06-15 22:46:23

Hi!

Doing "git push remote" pushes all my local branches by default. Is there a 
way to set it to *not* do that, and (for this particular remote repository) 
just push the current branch? Or failing that, not allow me to run "git 
push" without specifying a branch?

The git-config manual page leads me to believe that I should recofigure 
"remote.<name>.push", but it points me to the "refspec" spec on git-push, 
which is a tad cryptic.

-- 
\\// Peter - http://www.softwolves.pp.se/

Re: Not pushing all branches?

From: Imran M Yousuf <hidden>
Date: 2016-06-15 22:46:23

On Fri, Mar 13, 2009 at 1:48 PM, Peter Krefting [off-list ref] wrote:
Hi!

Doing "git push remote" pushes all my local branches by default. Is there a
way to set it to *not* do that, and (for this particular remote repository)
just push the current branch? Or failing that, not allow me to run "git
push" without specifying a branch?
Just try -
git push remote branch :)
The git-config manual page leads me to believe that I should recofigure
"remote.<name>.push", but it points me to the "refspec" spec on git-push,
which is a tad cryptic.

--
\\// Peter - http://www.softwolves.pp.se/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: imran@smartitengineering.com
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557

Re: Not pushing all branches?

From: John Tapsell <hidden>
Date: 2016-06-15 22:46:23

2009/3/13 Peter Krefting [off-list ref]:
Hi!

Doing "git push remote" pushes all my local branches by default. Is there a
way to set it to *not* do that, and (for this particular remote repository)
just push the current branch?
Or failing that, not allow me to run "git
push" without specifying a branch?
I've been pushing for this behaviour, and there was a patch a few days
ago to do this.  I'm not sure if it is/will be committed.

John Tapsell

Re: Not pushing all branches?

From: Peter Krefting <hidden>
Date: 2016-06-15 22:46:23

Imran M Yousuf:
Just try -
git push remote branch :)
That is what I do. Unfortunately, the times I forged to name the branch, it 
pushes my master branch, which is different from the remote's, and I have to 
go to the other repository and reset it manually...

-- 
\\// Peter - http://www.softwolves.pp.se/

Re: Not pushing all branches?

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:23

Hi,

On Fri, 13 Mar 2009, Peter Krefting wrote:
Imran M Yousuf:
quoted
Just try -
git push remote branch :)
That is what I do. Unfortunately, the times I forged to name the branch, 
it pushes my master branch, which is different from the remote's, and I 
have to go to the other repository and reset it manually...
You can set

$ git config remote.<remote>.push invalid-branch-name

so that

$ git push <remote>

will give you an error.

Ciao,
Dscho

Re: Not pushing all branches?

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:23

Hi,

On Fri, 13 Mar 2009, John Tapsell wrote:
2009/3/13 Peter Krefting [off-list ref]:
quoted
Doing "git push remote" pushes all my local branches by default. Is 
there a way to set it to *not* do that, and (for this particular 
remote repository) just push the current branch?
quoted
Or failing that, not allow me to run "git push" without specifying a 
branch?
I've been pushing for this behaviour, and there was a patch a few days 
ago to do this.  I'm not sure if it is/will be committed.
As Junio is a careful maintainer, he will not change anything radical 
which would piss of a lot of people _without_ a proper, long-term plan 
that gives users a chance.

I know, I once tried to push for something like that, and I am glad that 
Junio is too wise as to make Git unstable for existing users.

Ciao,
Dscho

Re: Not pushing all branches?

From: Finn Arne Gangstad <hidden>
Date: 2016-06-15 22:46:23

On Fri, Mar 13, 2009 at 10:44:49AM +0100, Peter Krefting wrote:
Imran M Yousuf:
quoted
Just try -
git push remote branch :)
That is what I do. Unfortunately, the times I forged to name the branch, 
it pushes my master branch, which is different from the remote's, and I 
have to go to the other repository and reset it manually...
I sent a patch series a few days ago to fix this in various ways,
adding a configuration variable push.default, and also indicating that
pushing nothing rather than pushing all matching branches is a safer
(and saner) default.

As you have also discovered, it is very easy to accidentally push
master to the wrong remote with the current default behavior.

- Finn Arne

Re: Not pushing all branches?

From: John Tapsell <hidden>
Date: 2016-06-15 22:46:23

2009/3/13 Johannes Schindelin [off-list ref]:
Hi,

On Fri, 13 Mar 2009, John Tapsell wrote:
quoted
2009/3/13 Peter Krefting [off-list ref]:
quoted
Doing "git push remote" pushes all my local branches by default. Is
there a way to set it to *not* do that, and (for this particular
remote repository) just push the current branch?
quoted
Or failing that, not allow me to run "git push" without specifying a
branch?
I've been pushing for this behaviour, and there was a patch a few days
ago to do this.  I'm not sure if it is/will be committed.
As Junio is a careful maintainer, he will not change anything radical
which would piss of a lot of people _without_ a proper, long-term plan
that gives users a chance.

I know, I once tried to push for something like that, and I am glad that
Junio is too wise as to make Git unstable for existing users.
Understandable.  There were 6 patches, only the last one changes the
default.  Hopefully the first 5 will be applied and the 6 will
debated, then grudgingly applied :-)

John

Re: Not pushing all branches?

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:23

Hi,

On Fri, 13 Mar 2009, John Tapsell wrote:
Hopefully the first 5 will be applied and the 6 will debated, then 
grudgingly applied :-)
No.  If it has to be applied grudgingly, it is most likely wrong.

Ciao,
Dscho

Re: Not pushing all branches?

From: John Tapsell <hidden>
Date: 2016-06-15 22:46:23

2009/3/13 Johannes Schindelin [off-list ref]:
Hi,

On Fri, 13 Mar 2009, John Tapsell wrote:
quoted
Hopefully the first 5 will be applied and the 6 will debated, then
grudgingly applied :-)
No.  If it has to be applied grudgingly, it is most likely wrong.
If there's an email about this every week from yet another person that
has been bitten by the current default, then the current default is
most likely wrong :-)

John

Re: Not pushing all branches?

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:46:23

John Tapsell venit, vidit, dixit 13.03.2009 14:56:
2009/3/13 Johannes Schindelin [off-list ref]:
quoted
Hi,

On Fri, 13 Mar 2009, John Tapsell wrote:
quoted
Hopefully the first 5 will be applied and the 6 will debated, then
grudgingly applied :-)
No.  If it has to be applied grudgingly, it is most likely wrong.
If there's an email about this every week from yet another person that
has been bitten by the current default, then the current default is
most likely wrong :-)
I think I've used git every day this week, pushed several times, and
still have no bite-marks. Does this count as several votes in the other
direction?

Michael

Re: Not pushing all branches?

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:23

Hi,

On Fri, 13 Mar 2009, John Tapsell wrote:
2009/3/13 Johannes Schindelin [off-list ref]:
quoted
On Fri, 13 Mar 2009, John Tapsell wrote:
quoted
Hopefully the first 5 will be applied and the 6 will debated, then 
grudgingly applied :-)
No.  If it has to be applied grudgingly, it is most likely wrong.
If there's an email about this every week from yet another person that 
has been bitten by the current default, then the current default is most 
likely wrong :-)
I suggest a different tack:

- try to come up with a solution that does not bite anybody,

- continue to modify the proposal until there are no objections left, and

- continue to be liked on the list.

;-)

Ciao,
Dscho

Re: Not pushing all branches?

From: Jeff King <hidden>
Date: 2016-06-15 22:46:23

On Fri, Mar 13, 2009 at 08:48:55AM +0100, Peter Krefting wrote:
Doing "git push remote" pushes all my local branches by default. Is there 
a way to set it to *not* do that, and (for this particular remote 
repository) just push the current branch? Or failing that, not allow me to 
run "git push" without specifying a branch?

The git-config manual page leads me to believe that I should recofigure  
"remote.<name>.push", but it points me to the "refspec" spec on git-push,  
which is a tad cryptic.
There seem to be a lot of responses in this thread, but nobody has
suggested:

  git config remote.$remote.push HEAD

It isn't mentioned in the git-push manpage; maybe a documentation patch
to give an example using HEAD would make sense?

-Peff

[PATCH] git-push.txt: describe how to default to pushing only current branch

From: Chris Johnsen <hidden>
Date: 2016-06-15 22:46:23

---
Jeff King [off-list ref] writes:
  git config remote.$remote.push HEAD

It isn't mentioned in the git-push manpage; maybe a documentation
patch to give an example using HEAD would make sense?
Here is a patch. It also attempts to document bare 'git push'.

In the resulting manpage the inline commands are not very
obvious (the HTML looks OK though). There is some sort of
formatting in there, but it does not seem to display any
differently from the surrounding text when I use man to view it
on my system.  Would it be better to do something like wrap
double quotes around the inline commands to help readers viewing
the manpage?
---
 Documentation/git-push.txt |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 4e7e5a7..fd53c49 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -24,8 +24,8 @@ every time you push into it, by setting up 'hooks' there.  See
 documentation for linkgit:git-receive-pack[1].
 
 
-OPTIONS
--------
+OPTIONS[[OPTIONS]]
+------------------
 <repository>::
 	The "remote" repository that is destination of a push
 	operation.  This parameter can be either a URL
@@ -187,6 +187,28 @@ reason::
 Examples
 --------
 
+git push::
+	Works like `git push <remote>`, where <remote> is the
+	current branch's remote (or `origin`, if no remote is
+	configured for the current branch).
+
+git push origin::
+	Without additional configuration, works like
+	`git push origin :`.
++
+The default behavior of this command when no <refspec> is given can be
+configured by setting the `push` option of the remote.
++
+For example, to default to pushing only the current branch to `origin`
+use `git config remote.origin.push HEAD`.  Any valid <refspec> (like
+the ones in the examples below) can be configured as the default for
+`git push origin`.
+
+git push origin :::
+	Push "matching" branches to `origin`. See
+	<refspec> in the <<OPTIONS,OPTIONS>> section above for a
+	description of "matching" branches.
+
 git push origin master::
 	Find a ref that matches `master` in the source repository
 	(most likely, it would find `refs/heads/master`), and update
-- 
1.6.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help