{"thread":{"id":"34896","subject":"push.default=upstream doesn't play nicely with remote.pushdefault/branch.*.pushremote","startedAt":"2013-09-10T13:10:57Z","lastAt":"2013-09-11T00:38:20Z","messageCount":3,"participants":["Ximin Luo","Junio C Hamano","Felipe Contreras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"227318","messageId":"522F1A61.3010805@gmx.com","threadId":"34896","inReplyTo":null,"subject":"push.default=upstream doesn't play nicely with remote.pushdefault/branch.*.pushremote","fromName":"Ximin Luo","fromEmail":"infinity0@gmx.com","sentAt":"2013-09-10T13:10:57Z","receivedAt":"2013-09-10T13:10:57Z","isPatch":false,"sender":{"key":"infinity0@gmx.com","avatar":null},"body":"(Please CC me as I am not subscribed.)\n\n$ git config -l | grep '^branch.master\\|^push.'\npush.default=upstream\nbranch.master.remote=upstream\nbranch.master.merge=refs/heads/master\nbranch.master.pushremote=origin\n\n$ git branch\n* master\n\n$ git push\nfatal: You are pushing to remote 'origin', which is not the upstream of\nyour current branch 'master', without telling me what to push\nto update which remote branch.\n\npush.default=upstream means \"push back where it came from (*)\". However, if I specifically define remote.pushdefault or branch.*.pushremote, this clearly means I don't want to do (*) in this case.\n\nThe question here then is, what remote branch should git push to - since pushremote only specifies a repo? I can suggest two options:\n\n- A: push to branch.*.merge if it's defined; otherwise push to <current branch> (like push.default=current)\n- B: push to <current branch> regardless\n\nB is probably simpler and means you can amend the push.default manual entry more easily:\n\nupstream: [..] This mode only makes sense if you are pushing to the same repository you would normally pull from (i.e. central workflow). <INS>If you are not pushing to the same repository, acts as \"current\".</INS>\n\n(Note again; that this is a special case when push.default=upstream because of the \"this mode only makes sense\" semantics. The other values for push.default are simpler and do not result in a conflict.)\n\nAlternatively, an even more simple behaviour is to adjust the error message to communicate the root cause:\n\n$ git push\nfatal: branch.*.pushremote is not compatible with push.default = upstream\n\nX\n\n-- \nGPG: 4096R/1318EFAC5FBBDBCE\ngit://github.com/infinity0/pubkeys.git\n\n"},{"id":"227323","messageId":"xmqqsixczmnu.fsf@gitster.dls.corp.google.com","threadId":"34896","inReplyTo":"522F1A61.3010805@gmx.com","subject":"Re: push.default=upstream doesn't play nicely with remote.pushdefault/branch.*.pushremote","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-09-10T16:06:29Z","receivedAt":"2013-09-10T16:06:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ximin Luo <infinity0@gmx.com> writes:\n\n> (Please CC me as I am not subscribed.)\n>\n> $ git config -l | grep '^branch.master\\|^push.'\n> push.default=upstream\n> branch.master.remote=upstream\n> branch.master.merge=refs/heads/master\n> branch.master.pushremote=origin\n>\n> $ git branch\n> * master\n>\n> $ git push\n> fatal: You are pushing to remote 'origin', which is not the upstream of\n> your current branch 'master', without telling me what to push\n> to update which remote branch.\n>\n> push.default=upstream means \"push back where it came from (*)\". However, if I specifically define remote.pushdefault or branch.*.pushremote, this clearly means I don't want to do (*) in this case.\n\nI think this was discussed on the list during the last development\ncycle.  Please check the list archive.\n\n\"git config --help\" has this to say about it:\n\n    * `upstream` - push the current branch back to the branch whose\n      changes are usually integrated into the current branch (which is\n      called `@{upstream}`).  This mode only makes sense if you are\n      pushing to the same repository you would normally pull from\n      (i.e. central workflow).\n\n    * `simple` - in centralized workflow, work like `upstream` with an\n      added safety to refuse to push if the upstream branch's name is\n      different from the local one.\n\n      When pushing to a remote that is different from the remote you normally\n      pull from, work as `current`.\n"},{"id":"227401","messageId":"CAMP44s0ZnGAhMv0a4HbVkZ6voRzxrXW-4T6Dj=H3Lb3kGFsOHA@mail.gmail.com","threadId":"34896","inReplyTo":"522F1A61.3010805@gmx.com","subject":"Re: push.default=upstream doesn't play nicely with remote.pushdefault/branch.*.pushremote","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-09-11T00:38:20Z","receivedAt":"2013-09-11T00:38:20Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Tue, Sep 10, 2013 at 8:10 AM, Ximin Luo <infinity0@gmx.com> wrote:\n> (Please CC me as I am not subscribed.)\n\nNo need to say that, Git mailing list is sane and doesn't do reply-to munging.\n\n> The question here then is, what remote branch should git push to - since pushremote only specifies a repo? I can suggest two options:\n>\n> - A: push to branch.*.merge if it's defined; otherwise push to <current branch> (like push.default=current)\n> - B: push to <current branch> regardless\n\nOr C: introduce the concept of a publish branch to complement pushremote:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/233572\n\n-- \nFelipe Contreras\n"}]}