{"thread":{"id":"23150","subject":"How to ignore changes on remote","startedAt":"2010-03-23T13:54:54Z","lastAt":"2010-03-23T18:02:35Z","messageCount":14,"participants":["Howard Miller","Sylvain Rabot","Santi Béjar","Alexander Iljin","Scott Chacon","Johannes Sixt","Junio C Hamano","Johan Herland","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137634","messageId":"26ae428a1003230654m50c35caci4a02e2df321f289c@mail.gmail.com","threadId":"23150","inReplyTo":null,"subject":"How to ignore changes on remote","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-03-23T13:54:54Z","receivedAt":"2010-03-23T13:54:54Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"My remote branch has changes that are not fast forward (I forgot to\nmerge). I have now made incompatible changes on my local branch. I\nsimply want to use the local version and push it to the remote. I\ndon't care about the remote version. I don't want to merge as there'll\nbe loads of conflicts and the answer will always be 'use the local\none'. Is there an easy way to do this? I can't think of anything.\n\nCheers!\n"},{"id":"137635","messageId":"1269353235.14299.0.camel@kheops","threadId":"23150","inReplyTo":"26ae428a1003230654m50c35caci4a02e2df321f289c@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-23T14:07:15Z","receivedAt":"2010-03-23T14:07:15Z","isPatch":false,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"On Tue, 2010-03-23 at 13:54 +0000, Howard Miller wrote:\n> My remote branch has changes that are not fast forward (I forgot to\n> merge). I have now made incompatible changes on my local branch. I\n> simply want to use the local version and push it to the remote. I\n> don't care about the remote version. I don't want to merge as there'll\n> be loads of conflicts and the answer will always be 'use the local\n> one'. Is there an easy way to do this? I can't think of anything.\n> \n> Cheers!\n\ngit push origin +local_branch:remote_branch\n\n-- \nSylvain Rabot <sylvain@abstraction.fr>\n"},{"id":"137636","messageId":"26ae428a1003230713y12f0c74dh3b22c0d97565159b@mail.gmail.com","threadId":"23150","inReplyTo":"1269353235.14299.0.camel@kheops","subject":"Re: How to ignore changes on remote","fromName":"Howard Miller","fromEmail":"howardsmiller@googlemail.com","sentAt":"2010-03-23T14:13:29Z","receivedAt":"2010-03-23T14:13:29Z","isPatch":false,"sender":{"key":"howardsmiller@googlemail.com","avatar":"https://gravatar.com/avatar/69a7274bc5c4c66910b00e4ea6590e46e2325b53ff4807854f3ed469b49400b1?d=mp&s=160"},"body":">\n> git push origin +local_branch:remote_branch\n>\n\nThanks!\n\nTell me more about that '+'. I've never heard of it before. Can't see\nanything in the docs (although I'm probably not looking in the right\nplace)\n"},{"id":"137640","messageId":"465338777.20100323202112@yandex.ru","threadId":"23150","inReplyTo":"26ae428a1003230713y12f0c74dh3b22c0d97565159b@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Alexander Iljin","fromEmail":"ajsoft@yandex.ru","sentAt":"2010-03-23T14:21:12Z","receivedAt":"2010-03-23T14:21:12Z","isPatch":false,"sender":{"key":"ajsoft@yandex.ru","avatar":"https://gravatar.com/avatar/5d53b714db7aaf3add180e650b6cbcfc17cd4ca0f29981ad97222e969a24bebb?d=mp&s=160"},"body":"Hello!\n\n>>\n>> git push origin +local_branch:remote_branch\n>>\n\nHM> Tell me more about that '+'. I've never heard of it before. Can't see\nHM> anything in the docs (although I'm probably not looking in the right\nHM> place)\n\n  git help push\n\n<refspec>…\n  The format of a <refspec> parameter is an optional plus +, followed\n  by the source ref <src>, followed by a colon :, followed by the\n  destination ref <dst>. It is used to specify with what <src> object\n  the <dst> ref in the remote repository is to be updated.\n\n  ...\n\n  By having the optional leading +, you can tell git to update the\n  <dst> ref even when the update is not a fast forward. This does not\n  attempt to merge <src> into <dst>. See EXAMPLES below for details.\n\n---=====---\n Alexander\n"},{"id":"137637","messageId":"adf1fd3d1003230722t338c140an527b77f4023c9729@mail.gmail.com","threadId":"23150","inReplyTo":"26ae428a1003230713y12f0c74dh3b22c0d97565159b@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2010-03-23T14:22:49Z","receivedAt":"2010-03-23T14:22:49Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Tue, Mar 23, 2010 at 3:13 PM, Howard Miller\n<howardsmiller@googlemail.com> wrote:\n>>\n>> git push origin +local_branch:remote_branch\n>>\n>\n> Thanks!\n>\n> Tell me more about that '+'. I've never heard of it before. Can't see\n> anything in the docs (although I'm probably not looking in the right\n> place)\n\nman git-push and search for '+', there is even an example like the\ncommand above.\n\nHTH,\nSanti\n"},{"id":"137638","messageId":"26ae428a1003230724o6b901e0s7d789f63d4718827@mail.gmail.com","threadId":"23150","inReplyTo":"adf1fd3d1003230722t338c140an527b77f4023c9729@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Howard Miller","fromEmail":"howardsmiller@googlemail.com","sentAt":"2010-03-23T14:24:59Z","receivedAt":"2010-03-23T14:24:59Z","isPatch":false,"sender":{"key":"howardsmiller@googlemail.com","avatar":"https://gravatar.com/avatar/69a7274bc5c4c66910b00e4ea6590e46e2325b53ff4807854f3ed469b49400b1?d=mp&s=160"},"body":">\n> man git-push and search for '+', there is even an example like the\n> command above.\n>\n\nNot on my docs (1.5.4) but it works anyway. Thanks!\n"},{"id":"137639","messageId":"1269354326.14299.7.camel@kheops","threadId":"23150","inReplyTo":"26ae428a1003230713y12f0c74dh3b22c0d97565159b@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Sylvain Rabot","fromEmail":"sylvain@abstraction.fr","sentAt":"2010-03-23T14:25:27Z","receivedAt":"2010-03-23T14:25:27Z","isPatch":false,"sender":{"key":"sylvain@abstraction.fr","avatar":"https://avatars.githubusercontent.com/u/153052?v=4"},"body":"On Tue, 2010-03-23 at 14:13 +0000, Howard Miller wrote:\n> >\n> > git push origin +local_branch:remote_branch\n> >\n> \n> Thanks!\n> \n> Tell me more about that '+'. I've never heard of it before. Can't see\n> anything in the docs (although I'm probably not looking in the right\n> place)\n\nhttp://kernel.org/pub/software/scm/git/docs/git-push.html\n\nthe '+' means that you want to bypass the security which does not allow\nnon fast-forward pushes.\n\nNote that you shouldn't do non fast-forward pushes to a repository which\ncan be cloned by other people than you. Once published (accessible to\nanybody) you should do a merge and then push to origin even if you only\ntake your local history in the merge to avoid user pulling from origin\nconflicts due to the non fast forward history.\n\nRegards.\n\n-- \nSylvain Rabot <sylvain@abstraction.fr>\n"},{"id":"137645","messageId":"d411cc4a1003230905y12839743x400333a0aa2e7018@mail.gmail.com","threadId":"23150","inReplyTo":"1269354326.14299.7.camel@kheops","subject":"Re: How to ignore changes on remote","fromName":"Scott Chacon","fromEmail":"schacon@gmail.com","sentAt":"2010-03-23T16:05:41Z","receivedAt":"2010-03-23T16:05:41Z","isPatch":false,"sender":{"key":"schacon@gmail.com","avatar":"https://gravatar.com/avatar/9b13a8a078e1dcf8588c4eea9554445d51ebed6c41b51f56f4d96738130b05c6?d=mp&s=160"},"body":"Why would we teach someone to do that instead of just recommending the\nfar less obscure 'git push -f'?  A leading '+' on the refspec is\nridiculously confusing compared to \"just tell it to force the push\nwith -f\".  Am I forgetting something?\n\nAlso, Howard, what do you mean by \"I forgot to merge\"?  Do other\npeople have push access to this branch?  You can't just tell people\n\"use the local version\" after you force a push.  If anyone has based\nwork off of that point, you're going to get into way more trouble\nforcing a non-ff push than if you just did a merge and then resolved\nall the conflicts as --ours.\n\nScott\n\nOn Tue, Mar 23, 2010 at 7:25 AM, Sylvain Rabot <sylvain@abstraction.fr> wrote:\n> On Tue, 2010-03-23 at 14:13 +0000, Howard Miller wrote:\n>> >\n>> > git push origin +local_branch:remote_branch\n>> >\n>>\n>> Thanks!\n>>\n>> Tell me more about that '+'. I've never heard of it before. Can't see\n>> anything in the docs (although I'm probably not looking in the right\n>> place)\n>\n> http://kernel.org/pub/software/scm/git/docs/git-push.html\n>\n> the '+' means that you want to bypass the security which does not allow\n> non fast-forward pushes.\n>\n> Note that you shouldn't do non fast-forward pushes to a repository which\n> can be cloned by other people than you. Once published (accessible to\n> anybody) you should do a merge and then push to origin even if you only\n> take your local history in the merge to avoid user pulling from origin\n> conflicts due to the non fast forward history.\n>\n> Regards.\n>\n> --\n> Sylvain Rabot <sylvain@abstraction.fr>\n>\n"},{"id":"137646","messageId":"26ae428a1003230913s447de452rfc7b8df753885365@mail.gmail.com","threadId":"23150","inReplyTo":"d411cc4a1003230905y12839743x400333a0aa2e7018@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Howard Miller","fromEmail":"howard@e-learndesign.co.uk","sentAt":"2010-03-23T16:13:03Z","receivedAt":"2010-03-23T16:13:03Z","isPatch":false,"sender":{"key":"howard@e-learndesign.co.uk","avatar":"https://gravatar.com/avatar/ddb66c6a4a077e52b823ac5b04f33ab927cb90e2ab1eafedaeba07b1920bb99e?d=mp&s=160"},"body":"On 23 March 2010 16:05, Scott Chacon <schacon@gmail.com> wrote:\n> Why would we teach someone to do that instead of just recommending the\n> far less obscure 'git push -f'?  A leading '+' on the refspec is\n> ridiculously confusing compared to \"just tell it to force the push\n> with -f\".  Am I forgetting something?\n>\n> Also, Howard, what do you mean by \"I forgot to merge\"?  Do other\n> people have push access to this branch?  You can't just tell people\n> \"use the local version\" after you force a push.  If anyone has based\n> work off of that point, you're going to get into way more trouble\n> forcing a non-ff push than if you just did a merge and then resolved\n> all the conflicts as --ours.\n\nI'm not really fussed. I hope not to make a habit of this. I'll\nprobably forget and ask again next time :)\n\nIt's not a repo that particularly matters - just a convenience thing\nfor some test scripts. If it had been on a proper production repo then\nI would just have dealt with the conflicts.\n"},{"id":"137648","messageId":"4BA8EA6A.4030607@viscovery.net","threadId":"23150","inReplyTo":"d411cc4a1003230905y12839743x400333a0aa2e7018@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-03-23T16:20:58Z","receivedAt":"2010-03-23T16:20:58Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 3/23/2010 17:05, schrieb Scott Chacon:\n> Why would we teach someone to do that instead of just recommending the\n> far less obscure 'git push -f'?  A leading '+' on the refspec is\n> ridiculously confusing compared to \"just tell it to force the push\n> with -f\".  Am I forgetting something?\n\n-f is dangerous. I was once bitten badly by a hastily typed\n\n   git push -f repo\n\nthat pushed two branches instead of only one: One needed an urgent update\n(that was the good one), but it also pushed the other one, which was not\nyet prepared for publication.\n\nBy teaching the +refspec form, you force the user to be careful which\nbranch is rewound. Yes, you can still say +refs/heads/*, but if you do\nthat, you are much more explicit than with \"push -f repo\", where the\naffected branches are hidden in the config file.\n\n-- Hannes\n"},{"id":"137649","messageId":"7vtys72dj8.fsf@alter.siamese.dyndns.org","threadId":"23150","inReplyTo":"d411cc4a1003230905y12839743x400333a0aa2e7018@mail.gmail.com","subject":"Re: How to ignore changes on remote","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-23T16:44:43Z","receivedAt":"2010-03-23T16:44:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Scott Chacon <schacon@gmail.com> writes:\n\n> Why would we teach someone to do that instead of just recommending the\n> far less obscure 'git push -f'?  A leading '+' on the refspec is\n> ridiculously confusing compared to \"just tell it to force the push\n> with -f\".  Am I forgetting something?\n\nI think \"-f\" would be simpler and easier for people who use only one\nbranch, as there is no \"I want to disable only for this branch but still\nwant other branches checked\" problem in such a case.\n\nOnce they graduate from that and start using more than one branches, \"-f\"\nis too broad a brush that disables the check for everything you push out,\nand you would want to teach \"+\" as a way to narrow the possible damage.\n\n\"git push -f origin this_branch_only\" can be used to limit the risk, but\nif they start from a short-and-lazy \"git push -f\" without arguments, their\nfinger would have harder time to learn it.  There is no such learning\ncurve issue for \"+\", as you cannot use it without saying for which branch\nto disable the check.\n"},{"id":"137650","messageId":"201003231820.51618.johan@herland.net","threadId":"23150","inReplyTo":"4BA8EA6A.4030607@viscovery.net","subject":"Re: How to ignore changes on remote","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2010-03-23T17:20:51Z","receivedAt":"2010-03-23T17:20:51Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Tuesday 23 March 2010, Johannes Sixt wrote:\n> Am 3/23/2010 17:05, schrieb Scott Chacon:\n> > Why would we teach someone to do that instead of just recommending\n> > the far less obscure 'git push -f'?  A leading '+' on the refspec\n> > is ridiculously confusing compared to \"just tell it to force the\n> > push with -f\".  Am I forgetting something?\n>\n> -f is dangerous. I was once bitten badly by a hastily typed\n>\n>    git push -f repo\n>\n> that pushed two branches instead of only one: One needed an urgent\n> update (that was the good one), but it also pushed the other one,\n> which was not yet prepared for publication.\n\nIMHO the main problem in this case is NOT with the -f option, but rather \nthat 'git push' defaults to pushing all \"matching\" branches. I'd much \nrather have push.default default to the much safer \"tracking\", which \npushes at most one branch. But changing default behaviour is hard to do \nwithout annoying old-timers.\n\nI'm rolling out Git at my $DAYJOB to a few hundred developers, and I \ninstruct them to\n\n\tgit config --global push.default tracking\n\nimmediately after installing Git. Which sucks, but is the only sane \nthing I can do to prevent this problem from haunting us.\n\n> By teaching the +refspec form, you force the user to be careful which\n> branch is rewound. Yes, you can still say +refs/heads/*, but if you\n> do that, you are much more explicit than with \"push -f repo\", where\n> the affected branches are hidden in the config file.\n\nIME refspecs are not easily grasped by Git newbies, and the longer they \ncan get by without having to learn them, the happier they'll be with \nGit. IMHO, refspecs are really cool and powerful, but you shouldn't \nhave to learn them in order to do day-to-day development.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"137656","messageId":"hoaus7$3br$1@dough.gmane.org","threadId":"23150","inReplyTo":"201003231820.51618.johan@herland.net","subject":"Re: How to ignore changes on remote","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-03-23T17:47:52Z","receivedAt":"2010-03-23T17:47:52Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johan Herland wrote:\n\n> I'm rolling out Git at my $DAYJOB to a few hundred developers, and I \n> instruct them to\n> \n>         git config --global push.default tracking\n> \n> immediately after installing Git. Which sucks, but is the only sane \n> thing I can do to prevent this problem from haunting us.\n\nWhy not have administrator use\n\n         git config --system push.default tracking\n\nonce (and/or setup skeleton for /etc/gitconfig)?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"137658","messageId":"201003231902.35962.johan@herland.net","threadId":"23150","inReplyTo":"hoaus7$3br$1@dough.gmane.org","subject":"Re: How to ignore changes on remote","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2010-03-23T18:02:35Z","receivedAt":"2010-03-23T18:02:35Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Tuesday 23 March 2010, Jakub Narebski wrote:\n> Johan Herland wrote:\n> > I'm rolling out Git at my $DAYJOB to a few hundred developers, and\n> > I instruct them to\n> >\n> >         git config --global push.default tracking\n> >\n> > immediately after installing Git. Which sucks, but is the only sane\n> > thing I can do to prevent this problem from haunting us.\n>\n> Why not have administrator use\n>\n>          git config --system push.default tracking\n>\n> once (and/or setup skeleton for /etc/gitconfig)?\n\nBecause developers administer their own machines.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"}]}