{"thread":{"id":"38861","subject":"A git hook that does git cherry-pick and push automatically","startedAt":"2015-03-20T04:07:28Z","lastAt":"2015-03-20T16:51:45Z","messageCount":4,"participants":["Ray Xie","David Aguilar","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"258084","messageId":"CAA4Z6SXzekMdPgKKaXqAObPcpFXDWpaQvNhJg6DEsOxbMOy3Lw@mail.gmail.com","threadId":"38861","inReplyTo":null,"subject":"A git hook that does git cherry-pick and push automatically","fromName":"Ray Xie","fromEmail":"samuiotoko925@gmail.com","sentAt":"2015-03-20T04:07:28Z","receivedAt":"2015-03-20T04:07:28Z","isPatch":false,"sender":{"key":"samuiotoko925@gmail.com","avatar":null},"body":"So today I had a shocking moment while I was doing my cherry-pick,\nafter I performed all the pre-checkin duties (the usual build the\ncode, run the test to make sure the cherry-pick infact works), I found\nout that my original commit was already cherry-picked, then I found\nout someone in engineering make the decision to do an automate\ncherry-pick from that branch to another so he added a git hook to run\ndo cherry-pick and push on every commit, yes, a simple cherry-pick\nthen push; mind you, these are not feature / dev branch, these are\nrelease branches, both of them.\n\nThen after I came back from the shock, made a big protest about how\nthis is the worst thing I have seen and I will never live with it, and\nthat's why \"git cherry-pick\" and \"git push\" are 2 separate commands,\nas any reasonable developer, you do your very best to ensure you are\nnot pushing something that is fundamentally broken; however for the\nlife of me and talk these few people into senses.\n\nSo, I am sending this to seek for some expert advice how I can drive\nsome sense into these people so they don't screw up my life as an\ndeveloper.\n\nRegards,\nDesperate developer, Ray.\n"},{"id":"258089","messageId":"20150320071625.GA90632@gmail.com","threadId":"38861","inReplyTo":"CAA4Z6SXzekMdPgKKaXqAObPcpFXDWpaQvNhJg6DEsOxbMOy3Lw@mail.gmail.com","subject":"Re: A git hook that does git cherry-pick and push automatically","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2015-03-20T07:16:26Z","receivedAt":"2015-03-20T07:16:26Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Mar 19, 2015 at 09:07:28PM -0700, Ray Xie wrote:\n> So today I had a shocking moment while I was doing my cherry-pick,\n> after I performed all the pre-checkin duties (the usual build the\n> code, run the test to make sure the cherry-pick infact works), I found\n> out that my original commit was already cherry-picked, then I found\n> out someone in engineering make the decision to do an automate\n> cherry-pick from that branch to another so he added a git hook to run\n> do cherry-pick and push on every commit, yes, a simple cherry-pick\n> then push; mind you, these are not feature / dev branch, these are\n> release branches, both of them.\n> \n> Then after I came back from the shock, made a big protest about how\n> this is the worst thing I have seen and I will never live with it, and\n> that's why \"git cherry-pick\" and \"git push\" are 2 separate commands,\n> as any reasonable developer, you do your very best to ensure you are\n> not pushing something that is fundamentally broken; however for the\n> life of me and talk these few people into senses.\n> \n> So, I am sending this to seek for some expert advice how I can drive\n> some sense into these people so they don't screw up my life as an\n> developer.\n> \n> Regards,\n> Desperate developer, Ray.\n\nIt's interesting that your clone picked up the hooks that they\nadded.  Do you have a centrally managed git installation, where\nperhaps they are modifying the default .git/hooks/ template that\nis used to seed the initial repo when cloning?\n\nOne way to check that is to look at your git installation.\nIf your git is installed as /usr/bin/git then check\n/usr/share/git-core/templates and see if the hook is present\nthere.\n\nAssuming that you have the ability to create your own clones,\nand that you are not all working in a common shared sandbox,\nthen the simplest solution would be to simply delete your\n.git/hooks/* when cloning a new repo.\n\nThat way you can at least have your sandboxes work the way\nyou want them to work.  Hooks are local to your sandbox so you\nhave full control over them.\n\nIs this hook resilient to rebasing?  Does it cause havoc if you\na feature onto this branch?  Those are the kinds of things that\nsound scary based on your description of the hook.\n\nI don't have any tips on how to convince people.  One thing that\nmight help is to remember that people are self-motivated ~ try\nto focus on what *they* stand to benefit from not having this\nhook.  If you can convince them that they are better-off without\nthe hook, from their POV, not from yours, then you might have a\nbetter chance of persuading them.\n\nGood luck,\n-- \nDavid\n"},{"id":"258095","messageId":"65D8F41C-9576-4899-B700-F779A30A1F42@gmail.com","threadId":"38861","inReplyTo":"20150320071625.GA90632@gmail.com","subject":"Re: A git hook that does git cherry-pick and push automatically","fromName":"Ray Xie","fromEmail":"samuiotoko925@gmail.com","sentAt":"2015-03-20T09:01:38Z","receivedAt":"2015-03-20T09:01:38Z","isPatch":false,"sender":{"key":"samuiotoko925@gmail.com","avatar":null},"body":"David,\n\nThanks for the suggestions, I left out the most unfortunate part of the problem I am facing, the one that add this hook is the git admin, aka our release engineer, so it's a sever side hook that it's forced down to all developers. I sure will try to persuade them from a different perspective more calmly this time.\n\nRegards,\nRay\n>> On Mar 20, 2015, at 12:16 AM, David Aguilar <davvid@gmail.com> wrote:\n>> \n>> On Thu, Mar 19, 2015 at 09:07:28PM -0700, Ray Xie wrote:\n>> So today I had a shocking moment while I was doing my cherry-pick,\n>> after I performed all the pre-checkin duties (the usual build the\n>> code, run the test to make sure the cherry-pick infact works), I found\n>> out that my original commit was already cherry-picked, then I found\n>> out someone in engineering make the decision to do an automate\n>> cherry-pick from that branch to another so he added a git hook to run\n>> do cherry-pick and push on every commit, yes, a simple cherry-pick\n>> then push; mind you, these are not feature / dev branch, these are\n>> release branches, both of them.\n>> \n>> Then after I came back from the shock, made a big protest about how\n>> this is the worst thing I have seen and I will never live with it, and\n>> that's why \"git cherry-pick\" and \"git push\" are 2 separate commands,\n>> as any reasonable developer, you do your very best to ensure you are\n>> not pushing something that is fundamentally broken; however for the\n>> life of me and talk these few people into senses.\n>> \n>> So, I am sending this to seek for some expert advice how I can drive\n>> some sense into these people so they don't screw up my life as an\n>> developer.\n>> \n>> Regards,\n>> Desperate developer, Ray.\n> \n> It's interesting that your clone picked up the hooks that they\n> added.  Do you have a centrally managed git installation, where\n> perhaps they are modifying the default .git/hooks/ template that\n> is used to seed the initial repo when cloning?\n> \n> One way to check that is to look at your git installation.\n> If your git is installed as /usr/bin/git then check\n> /usr/share/git-core/templates and see if the hook is present\n> there.\n> \n> Assuming that you have the ability to create your own clones,\n> and that you are not all working in a common shared sandbox,\n> then the simplest solution would be to simply delete your\n> .git/hooks/* when cloning a new repo.\n> \n> That way you can at least have your sandboxes work the way\n> you want them to work.  Hooks are local to your sandbox so you\n> have full control over them.\n> \n> Is this hook resilient to rebasing?  Does it cause havoc if you\n> a feature onto this branch?  Those are the kinds of things that\n> sound scary based on your description of the hook.\n> \n> I don't have any tips on how to convince people.  One thing that\n> might help is to remember that people are self-motivated ~ try\n> to focus on what *they* stand to benefit from not having this\n> hook.  If you can convince them that they are better-off without\n> the hook, from their POV, not from yours, then you might have a\n> better chance of persuading them.\n> \n> Good luck,\n> -- \n> David\n"},{"id":"258133","messageId":"CAGZ79kYsuY1u6_j=_9dBx3cK8o6kV3L4cOGafBv+doDVdJFUuQ@mail.gmail.com","threadId":"38861","inReplyTo":"65D8F41C-9576-4899-B700-F779A30A1F42@gmail.com","subject":"Re: A git hook that does git cherry-pick and push automatically","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-03-20T16:51:45Z","receivedAt":"2015-03-20T16:51:45Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"> so it's a sever side hook that it's forced down to all developers.\n\nHow does that work?\n\n/me is just curious\n"}]}