* git push
@ 2009-02-25 6:38 John Tapsell
2009-02-25 6:46 ` Jeff King
2009-02-25 7:01 ` Junio C Hamano
0 siblings, 2 replies; 18+ messages in thread
From: John Tapsell @ 2009-02-25 6:38 UTC (permalink / raw)
To: Git Mailing List
Hi all,
Following the idea of 'least damage', what do people think of making
"git push" only push the branch you are currently on?
I've accidentally committed commits in other branches because of a
git push. I know there's some magic config kung-foo that you can do
to try to tame git push to just the current branch, but it would make
sense to have this as default.
John
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 6:38 John Tapsell
@ 2009-02-25 6:46 ` Jeff King
2009-02-25 7:01 ` Junio C Hamano
1 sibling, 0 replies; 18+ messages in thread
From: Jeff King @ 2009-02-25 6:46 UTC (permalink / raw)
To: John Tapsell; +Cc: Git Mailing List
On Wed, Feb 25, 2009 at 06:38:41AM +0000, John Tapsell wrote:
> Following the idea of 'least damage', what do people think of making
> "git push" only push the branch you are currently on?
I think it has been discussed several times in the past. I think the
most recent was last October. So you might try searching the list
archives around that time.
-Peff
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 6:38 John Tapsell
2009-02-25 6:46 ` Jeff King
@ 2009-02-25 7:01 ` Junio C Hamano
2009-02-25 7:09 ` John Tapsell
2009-02-25 22:58 ` Finn Arne Gangstad
1 sibling, 2 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-02-25 7:01 UTC (permalink / raw)
To: John Tapsell; +Cc: Git Mailing List
John Tapsell <johnflux@gmail.com> writes:
> Following the idea of 'least damage', what do people think of making
> "git push" only push the branch you are currently on?
Having an easy way to ask to push only one branch (typically the currently
checked-out one) is a good thing. You can obviously say "git push origin
master" (or whatever branch you are on). We also added "git push origin
HEAD". I thought we even added "git push HEAD" or "git push --current",
but I may be mistaken.
But if you are talking about changing the default when "git push" is run
without any parameter, I have to say it is a terrible idea, for two
reasons, and one is too obvious to state so I wouldn't repeat it and talk
only about the other one.
I've noticed that people who ask for such a default tend to push too often
and worse they tend to push before they have their act together. Surely
their other branches may not be ready, but it is likely their current
branch isn't either ;-)
If you shoot for the least damage for such people, the sanest default for
"git push" would be to do nothing. You *always* say what to push where,
then there is no risk of pushing something you did not intend to. Perhaps
"push.default = never" configuration may not be such a bad idea?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 7:01 ` Junio C Hamano
@ 2009-02-25 7:09 ` John Tapsell
2009-02-25 7:44 ` Junio C Hamano
2009-02-25 22:58 ` Finn Arne Gangstad
1 sibling, 1 reply; 18+ messages in thread
From: John Tapsell @ 2009-02-25 7:09 UTC (permalink / raw)
To: Git Mailing List
2009/2/25 Junio C Hamano <gitster@pobox.com>:
> John Tapsell <johnflux@gmail.com> writes:
>
>> Following the idea of 'least damage', what do people think of making
>> "git push" only push the branch you are currently on?
>
> Having an easy way to ask to push only one branch (typically the currently
> checked-out one) is a good thing. You can obviously say "git push origin
> master" (or whatever branch you are on). We also added "git push origin
> HEAD". I thought we even added "git push HEAD" or "git push --current",
> but I may be mistaken.
>
> But if you are talking about changing the default when "git push" is run
> without any parameter, I have to say it is a terrible idea, for two
> reasons, and one is too obvious to state so I wouldn't repeat it and talk
> only about the other one.
Presumably the obvious is that it might be confusing to existing
users? Perhaps, but it doesn't cause any damage. It's moving to a
'safer' default.
> I've noticed that people who ask for such a default tend to push too often
> and worse they tend to push before they have their act together. Surely
> their other branches may not be ready, but it is likely their current
> branch isn't either ;-)
You're against making push affect only the current branch in order to
punish people who push too often? Okaaay..
> If you shoot for the least damage for such people, the sanest default for
> "git push" would be to do nothing. You *always* say what to push where,
> then there is no risk of pushing something you did not intend to. Perhaps
> "push.default = never" configuration may not be such a bad idea?
That wouldn't be a terrible idea, although perhaps a bit strange.
John
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 7:09 ` John Tapsell
@ 2009-02-25 7:44 ` Junio C Hamano
2009-02-25 9:02 ` Jeff King
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-02-25 7:44 UTC (permalink / raw)
To: John Tapsell; +Cc: Git Mailing List
John Tapsell <johnflux@gmail.com> writes:
> 2009/2/25 Junio C Hamano <gitster@pobox.com>:
>
>> Having an easy way to ask to push only one branch (typically the currently
>> checked-out one) is a good thing. You can obviously say "git push origin
>> master" (or whatever branch you are on). We also added "git push origin
>> HEAD". I thought we even added "git push HEAD" or "git push --current",
>> but I may be mistaken.
>>
>> But if you are talking about changing the default when "git push" is run
>> without any parameter, I have to say it is a terrible idea, for two
>> reasons, and one is too obvious to state so I wouldn't repeat it and talk
>> only about the other one.
>
> Presumably the obvious is that it might be confusing to existing
> users? Perhaps, but it doesn't cause any damage. It's moving to a
> 'safer' default.
No, it is not merely confusing but is outright dangerous to people who
expect the "matching refs" behaviour. It is not safer at all.
For example, I almost always have some topic branch checked out and
working on changes that are still not in any of my integration branches.
The workflow is to first finish topics to satisfaction, merge the ones
that are ready into their respective integration branches, and in other
work trees (created by contrib/workdir/git-new-workdir) run the whole
build and test cycle for them in the background. While waiting for them
to build and verified, the repository I primarily work in will have a
checkout of some other uncooked topic branch that I have no intention to
push out yet because I am still working on it. After a while, the
background build and test will complete and all integration branches prove
themselves to be ready to be pushed out, and I can say "git push", fully
expecting that the "matching refs" behaviour will push out the integration
branches and nothing else, because they are the only ones I have on the
public side for people (either git or day-job) to look at. I would never
want "push current branch" to send the uncooked topic branch, which I
would never want to have on the other side even if it is fully cooked.
Even when I am on 'master', when I push things out, I do not want to hear
from people that I have been forgetting to push out integration branches
other than 'master' only because you suddenly changed the default under
me after a few days.
Please don't talk about changing the default without thinking the
ramifications through.
>> I've noticed that people who ask for such a default tend to push too often
>> and worse they tend to push before they have their act together. Surely
>> their other branches may not be ready, but it is likely their current
>> branch isn't either ;-)
>
> You're against making push affect only the current branch in order to
> punish people who push too often? Okaaay..
"Too often" is not a problem by itself per-se, but "still broken"
certainly is, and "not thought through" also is to a certain degree. You
often see people commit and push out an early part of a series, and then
later regret that they realize the approach in these initial segment does
not pan out and another avenue was much better, but it is too late to take
them back and rebase.
And there unfortunately is a correlation between "too often" and the other
two. Not very strong correlation with "still broken", but moderately
strong correlation with "not thought through".
And this is not about punishing. It is about getting into a different
mindset. Unlike CVS/SVN, committing and publishing can be made into
different phases with git, and not pushing too early allows you produce a
lot better results. "I want to push only this branch" is often (not
always, but "often" stands with strong correlation) a sign that other
things are not ready, and by definition you couldn't have thought through
interactions between what you _think_ is ready (i.e. the current branch)
and the other ones that are not ready. In other words, it is about
encouraging people to think things through before publishing.
>> If you shoot for the least damage for such people, the sanest default for
>> "git push" would be to do nothing. You *always* say what to push where,
>> then there is no risk of pushing something you did not intend to. Perhaps
>> "push.default = never" configuration may not be such a bad idea?
>
> That wouldn't be a terrible idea, although perhaps a bit strange.
I would say that is the sanest default, and I often wish people in the git
training industry never teach "git push" without $remote and $refs
parameter to new people until they understand what they are doing.
You can add words other than 'never' to the repertoire, such as 'current',
or 'matching'. I think the configuration actually should be
"remote.<name>.push", not "push.default", though.
Oh, and the value 'current' can be spelled as 'HEAD' already there.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 7:44 ` Junio C Hamano
@ 2009-02-25 9:02 ` Jeff King
2009-02-25 9:26 ` Junio C Hamano
2009-02-25 9:08 ` John Tapsell
2009-02-25 9:34 ` Jay Soffian
2 siblings, 1 reply; 18+ messages in thread
From: Jeff King @ 2009-02-25 9:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: John Tapsell, Git Mailing List
On Tue, Feb 24, 2009 at 11:44:44PM -0800, Junio C Hamano wrote:
> > Presumably the obvious is that it might be confusing to existing
> > users? Perhaps, but it doesn't cause any damage. It's moving to a
> > 'safer' default.
>
> No, it is not merely confusing but is outright dangerous to people who
> expect the "matching refs" behaviour. It is not safer at all.
I think this is a very good reason not to change the default "push"
behavior.
> And this is not about punishing. It is about getting into a different
> mindset. Unlike CVS/SVN, committing and publishing can be made into
> different phases with git, and not pushing too early allows you produce a
> lot better results. "I want to push only this branch" is often (not
> always, but "often" stands with strong correlation) a sign that other
> things are not ready, and by definition you couldn't have thought through
> interactions between what you _think_ is ready (i.e. the current branch)
> and the other ones that are not ready. In other words, it is about
> encouraging people to think things through before publishing.
But I don't buy this at all. It is totally dependent on workflow and how
you use branches. That is, the "readiness" of two branches may be
totally unrelated. One may be a short-term branch for today's work, and
the other may be a long-running branch that you have made a WIP commit
on. You may even have that WIP commit sitting there for days.
When you think about "is my current branch ready to push?" there is no
reason for you to think of that other long-running branch that you
haven't seen for days.
-Peff
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 7:44 ` Junio C Hamano
2009-02-25 9:02 ` Jeff King
@ 2009-02-25 9:08 ` John Tapsell
2009-02-25 9:49 ` Junio C Hamano
2009-02-25 9:34 ` Jay Soffian
2 siblings, 1 reply; 18+ messages in thread
From: John Tapsell @ 2009-02-25 9:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
2009/2/25 Junio C Hamano <gitster@pobox.com>:
> John Tapsell <johnflux@gmail.com> writes:
>
>> 2009/2/25 Junio C Hamano <gitster@pobox.com>:
>>
>>> Having an easy way to ask to push only one branch (typically the currently
>>> checked-out one) is a good thing. You can obviously say "git push origin
>>> master" (or whatever branch you are on). We also added "git push origin
>>> HEAD". I thought we even added "git push HEAD" or "git push --current",
>>> but I may be mistaken.
>>>
>>> But if you are talking about changing the default when "git push" is run
>>> without any parameter, I have to say it is a terrible idea, for two
>>> reasons, and one is too obvious to state so I wouldn't repeat it and talk
>>> only about the other one.
>>
>> Presumably the obvious is that it might be confusing to existing
>> users? Perhaps, but it doesn't cause any damage. It's moving to a
>> 'safer' default.
>
> No, it is not merely confusing but is outright dangerous to people who
> expect the "matching refs" behaviour. It is not safer at all.
I see your point - perhaps "git push" should push the current branch
if the branch name matches the remote name (so if the current 'git
push' would have pushed it). Otherwise tell the user how to force it
to push.
> Please don't talk about changing the default without thinking the
> ramifications through.
Talking about doesn't harm anything. I don't really get why you're a
bit hostile.
>>> I've noticed that people who ask for such a default tend to push too often
>>> and worse they tend to push before they have their act together. Surely
>>> their other branches may not be ready, but it is likely their current
>>> branch isn't either ;-)
>>
>> You're against making push affect only the current branch in order to
>> punish people who push too often? Okaaay..
>
> "Too often" is not a problem by itself per-se, but "still broken"
> certainly is, and "not thought through" also is to a certain degree. You
> often see people commit and push out an early part of a series, and then
> later regret that they realize the approach in these initial segment does
> not pan out and another avenue was much better, but it is too late to take
> them back and rebase.
>
> And there unfortunately is a correlation between "too often" and the other
> two. Not very strong correlation with "still broken", but moderately
> strong correlation with "not thought through".
>
> And this is not about punishing. It is about getting into a different
> mindset. Unlike CVS/SVN, committing and publishing can be made into
> different phases with git, and not pushing too early allows you produce a
> lot better results. "I want to push only this branch" is often (not
> always, but "often" stands with strong correlation) a sign that other
> things are not ready, and by definition you couldn't have thought through
> interactions between what you _think_ is ready (i.e. the current branch)
> and the other ones that are not ready. In other words, it is about
> encouraging people to think things through before publishing.
I'm a bit surprised that you always push all your branches at once. I
often have several branches checked out at different stages of
development. Perhaps working on a branch, then I find a serious bug,
so I switch to master and fix the bug there. I have never wanted to
push multiple branches at once.
>>> If you shoot for the least damage for such people, the sanest default for
>>> "git push" would be to do nothing. You *always* say what to push where,
>>> then there is no risk of pushing something you did not intend to. Perhaps
>>> "push.default = never" configuration may not be such a bad idea?
>>
>> That wouldn't be a terrible idea, although perhaps a bit strange.
>
> I would say that is the sanest default, and I often wish people in the git
> training industry never teach "git push" without $remote and $refs
> parameter to new people until they understand what they are doing.
>
> You can add words other than 'never' to the repertoire, such as 'current',
> or 'matching'. I think the configuration actually should be
> "remote.<name>.push", not "push.default", though.
>
> Oh, and the value 'current' can be spelled as 'HEAD' already there.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 9:02 ` Jeff King
@ 2009-02-25 9:26 ` Junio C Hamano
2009-02-25 9:51 ` Jeff King
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2009-02-25 9:26 UTC (permalink / raw)
To: Jeff King; +Cc: John Tapsell, Git Mailing List
Jeff King <peff@peff.net> writes:
> But I don't buy this at all. It is totally dependent on workflow and how
> you use branches.
Of course. "Encouraging a behaviour" means just that. A better workflow
and a better use of branches.
> When you think about "is my current branch ready to push?" there is no
> reason for you to think of that other long-running branch that you
> haven't seen for days.
Sorry, I have to disagree with that.
We are talking about people to whom the "push matching refs" is a problem,
and that means they are using a branch with the same name with other
people (either from a shared central repository or his own publishing
branch) to house long-running, intermediate, uncooked state.
Why aren't you forking off your own topic branch from such a branch that
is either shared (or for publishing)? For the purpose of this discussion,
shared branch is the same as your own publishing branch -- that's where
you put things that are *ready* to be seen by other people.
The one you haven't seen for days, if it is not shared, won't bother you
nor your "matching push", because you wouldn't have merged your uncooked
changes from your own topic branch to that shared branch yet.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 7:44 ` Junio C Hamano
2009-02-25 9:02 ` Jeff King
2009-02-25 9:08 ` John Tapsell
@ 2009-02-25 9:34 ` Jay Soffian
2009-02-25 9:51 ` Junio C Hamano
2 siblings, 1 reply; 18+ messages in thread
From: Jay Soffian @ 2009-02-25 9:34 UTC (permalink / raw)
To: John Tapsell; +Cc: Junio C Hamano, Git Mailing List
On Wed, Feb 25, 2009 at 2:44 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Oh, and the value 'current' can be spelled as 'HEAD' already there.
John - in case you missed this, the behavior you desire is already available:
(next)$ git config remote.origin.push HEAD
(next)$ git remote show origin
[...]
Local ref configured for 'git push':
HEAD pushes to next (fast forwardable)
(next)$ git checkout master
(master)$ git remote show origin
[...]
Local ref configured for 'git push':
HEAD pushes to master (fast forwardable)
j.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 9:08 ` John Tapsell
@ 2009-02-25 9:49 ` Junio C Hamano
2009-02-25 10:06 ` John Tapsell
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2009-02-25 9:49 UTC (permalink / raw)
To: John Tapsell; +Cc: Git Mailing List
John Tapsell <johnflux@gmail.com> writes:
> 2009/2/25 Junio C Hamano <gitster@pobox.com>:
>
>> Please don't talk about changing the default without thinking the
>> ramifications through.
>
> Talking about doesn't harm anything. I don't really get why you're a
> bit hostile.
I am not saying any discussion about the defaults is bad.
But these topics add flames from uninformed people we have to douse early
to the list traffic, and make it harder to find useful topics by degrading
S/N ratio.
In other words, it certainly harms a lot.
I just want people to think twice (or more) if the change you are going to
propose is worthwhile before imposing that cost to everybody. A couple of
changes around "git push" scheduled for 1.7.0 are default changes, and it
was worthwhile to discuss about them, but I do not think this one deserves
the human bandwidth, especially we already had discussion on it recently
and we have a reasonable configuration mechanism for doing what you want
already.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 9:34 ` Jay Soffian
@ 2009-02-25 9:51 ` Junio C Hamano
0 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2009-02-25 9:51 UTC (permalink / raw)
To: Jay Soffian; +Cc: John Tapsell, Git Mailing List
Jay Soffian <jaysoffian@gmail.com> writes:
> On Wed, Feb 25, 2009 at 2:44 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> Oh, and the value 'current' can be spelled as 'HEAD' already there.
>
> John - in case you missed this, the behavior you desire is already available:
>
> (next)$ git config remote.origin.push HEAD
> (next)$ git remote show origin
> [...]
> Local ref configured for 'git push':
> HEAD pushes to next (fast forwardable)
> (next)$ git checkout master
>
> (master)$ git remote show origin
> [...]
> Local ref configured for 'git push':
> HEAD pushes to master (fast forwardable)
Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 9:26 ` Junio C Hamano
@ 2009-02-25 9:51 ` Jeff King
0 siblings, 0 replies; 18+ messages in thread
From: Jeff King @ 2009-02-25 9:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: John Tapsell, Git Mailing List
On Wed, Feb 25, 2009 at 01:26:11AM -0800, Junio C Hamano wrote:
> Of course. "Encouraging a behaviour" means just that. A better workflow
> and a better use of branches.
I don't agree that it is necessarily a better workflow.
> > When you think about "is my current branch ready to push?" there is no
> > reason for you to think of that other long-running branch that you
> > haven't seen for days.
>
> Sorry, I have to disagree with that.
>
> We are talking about people to whom the "push matching refs" is a problem,
> and that means they are using a branch with the same name with other
> people (either from a shared central repository or his own publishing
> branch) to house long-running, intermediate, uncooked state.
I do this all the time by making "wip" commits on top of my topic
branches. I push the topic branches to a networked repo so they are
accessible and backed up. Then when I work, I do something like:
(1) git checkout jk/existing-topic
(2) hack hack hack
(3) # oops, must sleep on this topic
(4) git commit -a -m wip
(5) sleep sleep sleep
(6) # oops, I need to work on something else this morning
(6) git checkout -b jk/new-topic master
(7) # ok, master is ready
(8) git push origin HEAD
I don't want my WIP commit pushed; it is a purely local and temporary
placeholder.
It seems that you are suggesting that I should never put such uncooked
state onto a branch that has already been pushed. Which means I should
replace (4) with "git checkout -b jk/topic-subtopic". This is a pain.
When I come back to the topic, I want to:
git checkout jk/existing-topic
gitk origin.. ;# where was I? Oh right, a WIP.
I think where I am leaving your mental model is that my published
branches are not necessarily "long running" in the same way that you
think. I publish them so I can pick them up elsewhere, and maybe even so
other people can see what I'm working on. But they really are topic
branches.
-Peff
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 9:49 ` Junio C Hamano
@ 2009-02-25 10:06 ` John Tapsell
0 siblings, 0 replies; 18+ messages in thread
From: John Tapsell @ 2009-02-25 10:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
2009/2/25 Junio C Hamano <gitster@pobox.com>:
> John Tapsell <johnflux@gmail.com> writes:
>
>> 2009/2/25 Junio C Hamano <gitster@pobox.com>:
>>
>>> Please don't talk about changing the default without thinking the
>>> ramifications through.
>>
>> Talking about doesn't harm anything. I don't really get why you're a
>> bit hostile.
>
> I am not saying any discussion about the defaults is bad.
>
> But these topics add flames from uninformed people we have to douse early
> to the list traffic, and make it harder to find useful topics by degrading
> S/N ratio.
You know, there might be a reason why you get lots of "uninformed
people" complaining about the defaults. Distinguishing the flames
shouldn't be your first instinct :)
> In other words, it certainly harms a lot.
>
> I just want people to think twice (or more) if the change you are going to
> propose is worthwhile before imposing that cost to everybody. A couple of
> changes around "git push" scheduled for 1.7.0 are default changes, and it
> was worthwhile to discuss about them, but I do not think this one deserves
> the human bandwidth, especially we already had discussion on it recently
> and we have a reasonable configuration mechanism for doing what you want
> already.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 7:01 ` Junio C Hamano
2009-02-25 7:09 ` John Tapsell
@ 2009-02-25 22:58 ` Finn Arne Gangstad
2009-03-05 8:45 ` Andreas Ericsson
1 sibling, 1 reply; 18+ messages in thread
From: Finn Arne Gangstad @ 2009-02-25 22:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: John Tapsell, Git Mailing List
Sorry to people receiving this mail twice, the list ate my first reply
since it managed to hit the spam-filter (maybe I should take a hint... :)
On Tue, Feb 24, 2009 at 11:01:38PM -0800, Junio C Hamano wrote:
> [...]
>
> But if you are talking about changing the default when "git push" is run
> without any parameter, I have to say it is a terrible idea, for two
> reasons, and one is too obvious to state so I wouldn't repeat it and talk
> only about the other one.
The current default behaviour of git push is very annoying for us at
least. The current behaviour is _dangerous_ and leads to serious
problems. It is too easy for someone to write "git push". They hit
enter too soon, or they write it expecting to get usage
information. They do not necessarily expect to overwrite random
branches in a remote repository.
Most git commands are not destructive with no arguments at all, and
push is the _only_ command that really can screw things up for others,
so this command in particular should refrain from destructive default
behaviour.
An example of random branch overwriting:
$ mkdir a
$ cd a
$ git init
$ echo contents > file
$ git add file
$ git commit -m message
$ cd ..
$ git clone a b
$ cd b
$ git checkout -b gif-support
$ echo foo > somefile
$ git add somefile
$ git commit -m message
$ ( cd ../a && git branch gif-support) # Assume done by someone else
$ git checkout master
$ # <hack away, maybe commit a bit>
$ git push # <-- OOOPS! pushes gif-support!
Notice that what branches git push ends up pushing is out of your
control, since new branches can appear in the remote repository at any
time. This is very unfriendly in our setup with a shared incoming repo.
If developer A creates "gif-support", shares it with developer B, who
does an additional commit on it to make it print more debug info (but
has no intent of pushing it anywhere), and A pushes it to the "incoming"
repo, developer B risks overwriting that with his debug version.
It is not realistic to believe that in a big project with many
developers, no one will ever do the mistake of typing "git push". It
is also not realistic to believe that everyone will know how to (or
remember to) configure this away.
> If you shoot for the least damage for such people, the sanest default for
> "git push" would be to do nothing. You *always* say what to push where,
> then there is no risk of pushing something you did not intend to. Perhaps
> "push.default = never" configuration may not be such a bad idea?
If "git push" could do nothing at all without configuring anything, that
would be a big improvement to us.
- Finn Arne
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-02-25 22:58 ` Finn Arne Gangstad
@ 2009-03-05 8:45 ` Andreas Ericsson
2009-03-05 8:56 ` John Tapsell
2009-03-05 9:44 ` Finn Arne Gangstad
0 siblings, 2 replies; 18+ messages in thread
From: Andreas Ericsson @ 2009-03-05 8:45 UTC (permalink / raw)
To: Finn Arne Gangstad; +Cc: Junio C Hamano, John Tapsell, Git Mailing List
Finn Arne Gangstad wrote:
> Sorry to people receiving this mail twice, the list ate my first reply
> since it managed to hit the spam-filter (maybe I should take a hint... :)
>
> On Tue, Feb 24, 2009 at 11:01:38PM -0800, Junio C Hamano wrote:
>> [...]
>>
>> But if you are talking about changing the default when "git push" is run
>> without any parameter, I have to say it is a terrible idea, for two
>> reasons, and one is too obvious to state so I wouldn't repeat it and talk
>> only about the other one.
>
> The current default behaviour of git push is very annoying for us at
> least. The current behaviour is _dangerous_ and leads to serious
> problems. It is too easy for someone to write "git push". They hit
> enter too soon, or they write it expecting to get usage
> information. They do not necessarily expect to overwrite random
> branches in a remote repository.
>
> Most git commands are not destructive with no arguments at all, and
> push is the _only_ command that really can screw things up for others,
> so this command in particular should refrain from destructive default
> behaviour.
>
> An example of random branch overwriting:
> $ mkdir a
> $ cd a
> $ git init
> $ echo contents > file
> $ git add file
> $ git commit -m message
> $ cd ..
> $ git clone a b
> $ cd b
> $ git checkout -b gif-support
> $ echo foo > somefile
> $ git add somefile
> $ git commit -m message
> $ ( cd ../a && git branch gif-support) # Assume done by someone else
> $ git checkout master
> $ # <hack away, maybe commit a bit>
> $ git push # <-- OOOPS! pushes gif-support!
>
> Notice that what branches git push ends up pushing is out of your
> control, since new branches can appear in the remote repository at any
> time. This is very unfriendly in our setup with a shared incoming repo.
>
> If developer A creates "gif-support", shares it with developer B, who
> does an additional commit on it to make it print more debug info (but
> has no intent of pushing it anywhere), and A pushes it to the "incoming"
> repo, developer B risks overwriting that with his debug version.
>
git push will never overwrite changes in the remote repo unless you
specify --force. If anyone *blindly* uses --force, they really shouldn't
have write-access to anything so precious as your code repositories.
Worst-case scenario, you commits that were never intended for publication
enter your public wateringhole and needs a revert later on. Big deal.
> It is not realistic to believe that in a big project with many
> developers, no one will ever do the mistake of typing "git push". It
> is also not realistic to believe that everyone will know how to (or
> remember to) configure this away.
>
But it *is* realistic to not assume that they will also use --force
while doing so.
>> If you shoot for the least damage for such people, the sanest default for
>> "git push" would be to do nothing. You *always* say what to push where,
>> then there is no risk of pushing something you did not intend to. Perhaps
>> "push.default = never" configuration may not be such a bad idea?
>
> If "git push" could do nothing at all without configuring anything, that
> would be a big improvement to us.
>
I can buy this, I guess. I always type the remote-name I want to push to
anyways. A sane no-op default would probably be to list the pre-configured
remotes along with a short usage message. I still don't quite see the point
of it.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-03-05 8:45 ` Andreas Ericsson
@ 2009-03-05 8:56 ` John Tapsell
2009-03-05 9:44 ` Finn Arne Gangstad
1 sibling, 0 replies; 18+ messages in thread
From: John Tapsell @ 2009-03-05 8:56 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Finn Arne Gangstad, Junio C Hamano, Git Mailing List
2009/3/5 Andreas Ericsson <ae@op5.se>:
> Finn Arne Gangstad wrote:
>>
>> Sorry to people receiving this mail twice, the list ate my first reply
>> since it managed to hit the spam-filter (maybe I should take a hint... :)
>>
>> On Tue, Feb 24, 2009 at 11:01:38PM -0800, Junio C Hamano wrote:
>>>
>>> [...]
>>>
>>> But if you are talking about changing the default when "git push" is run
>>> without any parameter, I have to say it is a terrible idea, for two
>>> reasons, and one is too obvious to state so I wouldn't repeat it and talk
>>> only about the other one.
>>
>> The current default behaviour of git push is very annoying for us at
>> least. The current behaviour is _dangerous_ and leads to serious
>> problems. It is too easy for someone to write "git push". They hit
>> enter too soon, or they write it expecting to get usage
>> information. They do not necessarily expect to overwrite random
>> branches in a remote repository.
>>
>> Most git commands are not destructive with no arguments at all, and
>> push is the _only_ command that really can screw things up for others,
>> so this command in particular should refrain from destructive default
>> behaviour.
>>
>> An example of random branch overwriting:
>> $ mkdir a
>> $ cd a
>> $ git init
>> $ echo contents > file
>> $ git add file
>> $ git commit -m message
>> $ cd ..
>> $ git clone a b
>> $ cd b
>> $ git checkout -b gif-support
>> $ echo foo > somefile
>> $ git add somefile
>> $ git commit -m message
>> $ ( cd ../a && git branch gif-support) # Assume done by someone else
>> $ git checkout master
>> $ # <hack away, maybe commit a bit>
>> $ git push # <-- OOOPS! pushes gif-support!
>>
>> Notice that what branches git push ends up pushing is out of your
>> control, since new branches can appear in the remote repository at any
>> time. This is very unfriendly in our setup with a shared incoming repo.
>>
>> If developer A creates "gif-support", shares it with developer B, who
>> does an additional commit on it to make it print more debug info (but
>> has no intent of pushing it anywhere), and A pushes it to the "incoming"
>> repo, developer B risks overwriting that with his debug version.
>>
>
> git push will never overwrite changes in the remote repo unless you
> specify --force. If anyone *blindly* uses --force, they really shouldn't
> have write-access to anything so precious as your code repositories.
It's seems a very likely scenario to me.
I work on a remote branch with one other person, to make some new
feature. Once we are done, I rebase and get rid of the cruft from the
history, then "git push --force" to update the branch. Whoops, I've
just unknowingly wiped out a completely different branch.
>
> Worst-case scenario, you commits that were never intended for publication
> enter your public wateringhole and needs a revert later on. Big deal.
>
>> It is not realistic to believe that in a big project with many
>> developers, no one will ever do the mistake of typing "git push". It
>> is also not realistic to believe that everyone will know how to (or
>> remember to) configure this away.
>>
>
> But it *is* realistic to not assume that they will also use --force
> while doing so.
>
>>> If you shoot for the least damage for such people, the sanest default for
>>> "git push" would be to do nothing. You *always* say what to push where,
>>> then there is no risk of pushing something you did not intend to.
>>> Perhaps
>>> "push.default = never" configuration may not be such a bad idea?
>>
>> If "git push" could do nothing at all without configuring anything, that
>> would be a big improvement to us.
>>
>
> I can buy this, I guess. I always type the remote-name I want to push to
> anyways. A sane no-op default would probably be to list the pre-configured
> remotes along with a short usage message. I still don't quite see the point
> of it.
If people don't agree on changing 'git push' to affect only the
current branch, I would also go for making 'git push' a noop.
John
>
> --
> Andreas Ericsson andreas.ericsson@op5.se
> OP5 AB www.op5.se
> Tel: +46 8-230225 Fax: +46 8-230231
>
> Considering the successes of the wars on alcohol, poverty, drugs and
> terror, I think we should give some serious thought to declaring war
> on peace.
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
2009-03-05 8:45 ` Andreas Ericsson
2009-03-05 8:56 ` John Tapsell
@ 2009-03-05 9:44 ` Finn Arne Gangstad
1 sibling, 0 replies; 18+ messages in thread
From: Finn Arne Gangstad @ 2009-03-05 9:44 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Junio C Hamano, John Tapsell, Git Mailing List
On Thu, Mar 05, 2009 at 09:45:11AM +0100, Andreas Ericsson wrote:
> Worst-case scenario, you commits that were never intended for publication
> enter your public wateringhole and needs a revert later on. Big deal.
It could be a very big deal depending on what the contents are. I
think you can split developers in two groups - those who like to learn
a lot about version control systems, and those who just see it as a
necessary evil to get their job done. The latter seems to be the
majority.
The first group will know how to undo the damage from a bad push (and
probably configure their setup so they do not necessarily happen),
while the second group will not necessarily notice that it happened or
know how to undo it. So, bad pushes go through, and are not detected
before 3 other people base their work on it, and we get a lot of
hassle.
>> It is not realistic to believe that in a big project with many
>> developers, no one will ever do the mistake of typing "git push". It
>> is also not realistic to believe that everyone will know how to (or
>> remember to) configure this away.
>
> But it *is* realistic to not assume that they will also use --force
> while doing so.
Our public repos are set up so that only a few chosen people are
allowed to force pushes, so this is not an issue for us.
>> If "git push" could do nothing at all without configuring anything, that
>> would be a big improvement to us.
>
> I can buy this, I guess. I always type the remote-name I want to push to
> anyways. A sane no-op default would probably be to list the pre-configured
> remotes along with a short usage message. I still don't quite see the point
> of it.
I'll try to whip up a small patch series tonight and see what it ends
up looking like.
- Finn Arne
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: git push
[not found] <CAJmx4Nxh_WzkO-S=SN9E=aODCrfs+QCig4sT+Q8eQ+Pv1hB2+w@mail.gmail.com>
@ 2012-03-19 16:24 ` Kevin O'Brien
0 siblings, 0 replies; 18+ messages in thread
From: Kevin O'Brien @ 2012-03-19 16:24 UTC (permalink / raw)
To: git
I agree with your proposed change for git push behavior as described
here: http://lwn.net/Articles/487131/
I'm also going to go change my push.default in .gitconfig now as the
behavior described is actually what I desire.
We've recently moved to using git at Kiva, and so I'm also letting my
colleagues know of this change to see if they have any comments.
Thanks for public notice.
Cheers,
-kevin
Software Engineer
http://www.kiva.org
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2012-03-19 16:25 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAJmx4Nxh_WzkO-S=SN9E=aODCrfs+QCig4sT+Q8eQ+Pv1hB2+w@mail.gmail.com>
2012-03-19 16:24 ` git push Kevin O'Brien
2009-02-25 6:38 John Tapsell
2009-02-25 6:46 ` Jeff King
2009-02-25 7:01 ` Junio C Hamano
2009-02-25 7:09 ` John Tapsell
2009-02-25 7:44 ` Junio C Hamano
2009-02-25 9:02 ` Jeff King
2009-02-25 9:26 ` Junio C Hamano
2009-02-25 9:51 ` Jeff King
2009-02-25 9:08 ` John Tapsell
2009-02-25 9:49 ` Junio C Hamano
2009-02-25 10:06 ` John Tapsell
2009-02-25 9:34 ` Jay Soffian
2009-02-25 9:51 ` Junio C Hamano
2009-02-25 22:58 ` Finn Arne Gangstad
2009-03-05 8:45 ` Andreas Ericsson
2009-03-05 8:56 ` John Tapsell
2009-03-05 9:44 ` Finn Arne Gangstad
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).