{"thread":{"id":"33633","subject":"Making a (quick) commit to another branch","startedAt":"2013-04-27T14:06:37Z","lastAt":"2013-04-27T21:06:26Z","messageCount":4,"participants":["Johannes Schneider","Javier Domingo","Patrik Gornicz"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"215708","messageId":"517BDB6D.8040809@cedarsoft.com","threadId":"33633","inReplyTo":null,"subject":"Making a (quick) commit to another branch","fromName":"Johannes Schneider","fromEmail":"mailings@cedarsoft.com","sentAt":"2013-04-27T14:06:37Z","receivedAt":"2013-04-27T14:06:37Z","isPatch":false,"sender":{"key":"mailings@cedarsoft.com","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nHi guys,\n\nI love git. And I use it every day. But there is one minor thing, that\nbugs me a little bit:\nI am implementing something on a feature branch. Now I detect a minor\ntypo/bug/whatever that just needs a one line commit.\n\nBut of course I don't want to add that commit to my feature branch.\nInstead I'd like to commit that fix directly to another branch (e.g.\nmaster).\n\nUnfortunately that take a lot of steps to make this happen:\n- - comitting\n- - stashing other changes\n- - changing branch\n- - cherry-picking commit\n- - switching branches back\n- - reverting latest commit\n- - unstashing changes\n\nI'd love to solve this by having an option for git commit that gives\nme the possibility to commit to another branch:\n\n\ngit commit thefixedfile.txt -m \"fixed a typo\" -b master\n\n\n\nAny ideas/hints?\n\n\nThanks,\n\nJohannes\n\n- -- \nJohannes Schneider - blog.cedarsoft.com\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.11 (GNU/Linux)\n\niQEcBAEBAgAGBQJRe9ttAAoJEAytD9R7Qv6dPakH/2WshAEXM9JW2+OFW/9ZxEeL\nIQuE4U1OiIH9BRT9XixHQ0+d+Nay/510nFJw0kLLtOl3wRx1ybMvaennYp17Aqi6\nyVnDuYbhIsjQD5lFAueLsfDgZdawmWMEOMf/Sk5pX5GLjo9k9+mi/J3KDCqH89Dc\nFofgMVsZcXtFB7WS9YzzabOhfomIWhY48R8CblSatzB/r5R4xsTk6eryAgBZvaIz\nd2Rh9a54OVRBGeGX3mdgIgVWRHbquU+b1h4Lm8QraTfNGy4uN0hRtzFb356j7xq9\nUlA3CqW+w6lyBK14fdQ232jgRTkAPfgms0IShtD9UgBV0o+RBTe1Oa9abZ7sskY=\n=J4Dg\n-----END PGP SIGNATURE-----\n"},{"id":"215710","messageId":"CALZVap=9Z=0DPM1fNwotn3sN-W7mXMPRSJ2aY5jzkQTBD6v=Kw@mail.gmail.com","threadId":"33633","inReplyTo":"517BDB6D.8040809@cedarsoft.com","subject":"Re: Making a (quick) commit to another branch","fromName":"Javier Domingo","fromEmail":"javierdo1@gmail.com","sentAt":"2013-04-27T14:21:31Z","receivedAt":"2013-04-27T14:21:31Z","isPatch":false,"sender":{"key":"javierdo1@gmail.com","avatar":"https://gravatar.com/avatar/0f43d4d2e5f4320e8b5e1a46914213c5459dd0de261ab1587f222827f863d727?d=mp&s=160"},"body":"2013/4/27 Johannes Schneider <mailings@cedarsoft.com>:\n> -----BEGIN PGP SIGNED MESSAGE-----\n> Hash: SHA1\n>\n> Hi guys,\n>\n> I love git. And I use it every day. But there is one minor thing, that\n> bugs me a little bit:\n> I am implementing something on a feature branch. Now I detect a minor\n> typo/bug/whatever that just needs a one line commit.\n>\n> But of course I don't want to add that commit to my feature branch.\n> Instead I'd like to commit that fix directly to another branch (e.g.\n> master).\n>\n> Unfortunately that take a lot of steps to make this happen:\n> - - comitting\n> - - stashing other changes\n> - - changing branch\n> - - cherry-picking commit\n> - - switching branches back\n> - - reverting latest commit\n> - - unstashing changes\n>\n> I'd love to solve this by having an option for git commit that gives\n> me the possibility to commit to another branch:\n>\n>\n> git commit thefixedfile.txt -m \"fixed a typo\" -b master\n>\n>\n>\n> Any ideas/hints?\n>\n\nI would first recommend you, instead of cherry-picking the commit, you did this:\n-- stash\n-- go to the master branch\n-- fix the line\n-- commit the fix\n-- got to the feature branch\n-- unstash\n\nAs when you merge with master, git will carry on with the changes. I\ndon't see the need to cherry pick that commit.\n\nJavier Domingo\n"},{"id":"215712","messageId":"517BE727.1050000@mail.pgornicz.com","threadId":"33633","inReplyTo":"CALZVap=9Z=0DPM1fNwotn3sN-W7mXMPRSJ2aY5jzkQTBD6v=Kw@mail.gmail.com","subject":"Re: Making a (quick) commit to another branch","fromName":"Patrik Gornicz","fromEmail":"patrik-git@mail.pgornicz.com","sentAt":"2013-04-27T14:56:39Z","receivedAt":"2013-04-27T14:56:39Z","isPatch":false,"sender":{"key":"patrik-git@mail.pgornicz.com","avatar":null},"body":"I've also encountered this desire to quickly fix something in another \nbranch.\n\nMy need is more driven by the fact that it's a large project and \nstashing changes / switching branches frequently results in 2-6 minute \nbuild times afterward. Thus the commit to another branch suggestion \nwould be quite neat as I wouldn't have to stash/switch.\n\nAnother possible approach would be to allow cherry-picking a change \ninto another branch (without the stash/switch need).\n\nEither way though, things might be a little weird if there's a \nconflict. Most of the time with the types of changes I'd like to do \nthis simply won't be the case so perhaps just failing and requiring the \nuser to work around it with either of the suggested work arounds would \nbe effective enough . . .\n\nPatrik\n\nOn Sat Apr 27 10:21:31 2013, Javier Domingo wrote:\n> 2013/4/27 Johannes Schneider <mailings@cedarsoft.com>:\n>> -----BEGIN PGP SIGNED MESSAGE-----\n>> Hash: SHA1\n>>\n>> Hi guys,\n>>\n>> I love git. And I use it every day. But there is one minor thing, that\n>> bugs me a little bit:\n>> I am implementing something on a feature branch. Now I detect a minor\n>> typo/bug/whatever that just needs a one line commit.\n>>\n>> But of course I don't want to add that commit to my feature branch.\n>> Instead I'd like to commit that fix directly to another branch (e.g.\n>> master).\n>>\n>> Unfortunately that take a lot of steps to make this happen:\n>> - - comitting\n>> - - stashing other changes\n>> - - changing branch\n>> - - cherry-picking commit\n>> - - switching branches back\n>> - - reverting latest commit\n>> - - unstashing changes\n>>\n>> I'd love to solve this by having an option for git commit that gives\n>> me the possibility to commit to another branch:\n>>\n>>\n>> git commit thefixedfile.txt -m \"fixed a typo\" -b master\n>>\n>>\n>>\n>> Any ideas/hints?\n>>\n>\n> I would first recommend you, instead of cherry-picking the commit, you did this:\n> -- stash\n> -- go to the master branch\n> -- fix the line\n> -- commit the fix\n> -- got to the feature branch\n> -- unstash\n>\n> As when you merge with master, git will carry on with the changes. I\n> don't see the need to cherry pick that commit.\n>\n> Javier Domingo\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"215755","messageId":"517C3DD2.5090007@cedarsoft.com","threadId":"33633","inReplyTo":"CALZVap=9Z=0DPM1fNwotn3sN-W7mXMPRSJ2aY5jzkQTBD6v=Kw@mail.gmail.com","subject":"Re: Making a (quick) commit to another branch","fromName":"Johannes Schneider","fromEmail":"mailings@cedarsoft.com","sentAt":"2013-04-27T21:06:26Z","receivedAt":"2013-04-27T21:06:26Z","isPatch":false,"sender":{"key":"mailings@cedarsoft.com","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nOn 27.04.2013 16:21, Javier Domingo wrote:\n> I would first recommend you, instead of cherry-picking the commit,\n> you did this: -- stash -- go to the master branch -- fix the line \n> -- commit the fix -- got to the feature branch -- unstash\n\nYeah, of course u are right.\n\nThanks for pointing that out - saves me a few key strokes.\n\n\n\n\n\n\n> As when you merge with master, git will carry on with the changes.\n> I don't see the need to cherry pick that commit.\n> \n> Javier Domingo\n> \n\n- -- \nJohannes Schneider - blog.cedarsoft.com\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.11 (GNU/Linux)\n\niQEcBAEBAgAGBQJRfD3SAAoJEAytD9R7Qv6duWgH/2BIIuTP0FJTR9Duli+jyzd4\ndIicrkwuCCELiOe3XQ2vSgxxr0nUI52Vn0uCRaXwXJqz466/55PGvpNb/COnLUm0\nsSDXbQFVPZtb38AZIQvz844pzb5R9DMujp5g/3oA146x7LscPvrWmtSCK6mlGDa5\nbm9LUdULP9eMEJ1aJaqDYEDQ/vY/rS/66/c7G2+A1EysxIlW3t3aXLSosv/BGjbF\nl2RyHFeV0RsreeA+Aa1ZJoyheMqkDCVKijo/xfBnz7m9OFj12g1moSheD7p2hDJh\nUHQU4d9qrHmFcUAhkMe9wIP8Opr98Q7GZOq03p5DaWzWggV2HPcrP8rkmARx2Q8=\n=9I4w\n-----END PGP SIGNATURE-----\n"}]}