{"thread":{"id":"29998","subject":"2 cents regarding push.default change","startedAt":"2012-03-19T21:17:08Z","lastAt":"2012-03-19T21:17:08Z","messageCount":1,"participants":["George King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"187280","messageId":"CAE5dN1OqNFtiVxP6z6BbdtOfw+MvS5KNW6BYNYpVCVFePcVQPg@mail.gmail.com","threadId":"29998","inReplyTo":null,"subject":"2 cents regarding push.default change","fromName":"George King","fromEmail":"george@foursquare.com","sentAt":"2012-03-19T21:17:08Z","receivedAt":"2012-03-19T21:17:08Z","isPatch":false,"sender":{"key":"george@foursquare.com","avatar":null},"body":"Hello list,\n\nI saw a post on hacker news soliciting feedback for the patch to\ndefault to push.default=upstream, I would like to relate my own\nexperience using git at work. In short, I support the change.\n\nOne of the more embarrassing things I have done here was 'push\n--force' all branches to origin because of the current default,\n'push.default=current'. The mistake would have been avoided with the\nproposed change. The scenario was as follows:\n\n- Our git server has master and main dev branches, as well as a number\nof 'private' branches. The distinction between public / shared\nbranches and private / personal branches is informal within my team\n(which is perfectly reasonable I think).\n\n- I rebased a private branch locally, and wanted to save my day's work\nto the server. because of the rebase, when I ran 'git push' the server\nrejected it.\n\n- Because I was working in a private branch,  I thought it reasonable\nto run 'git push --force'.\n\n- Because I had not pulled recently, my history for branch 'master' was behind.\n\n- The result was that in addition to forcing my private branch to the\nnew state (as desired), master was rewound to an old state,\neffectively discarding the work of all my coworkers for the day.\n\n- Luckily they still had their recent commits locally, so they were\nable to push again and restore origin/master.\n\nWhen this happened, my immediate reaction was 'git should not allow\nthat!' I immediately did some reading, discovered\n'push.default=upstream', and my team made that setting part our policy\non the spot.\n\nAside from this particular problem, I also find the 'upstream' setting\nmore convenient, because I do not have to bring all branches up to\ndate before issuing 'git push'.\n\nHope that helps,\n\nGeorge King\n"}]}