git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Making a (quick) commit to another branch
@ 2013-04-27 14:06 Johannes Schneider
  2013-04-27 14:21 ` Javier Domingo
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schneider @ 2013-04-27 14:06 UTC (permalink / raw)
  To: git

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

I love git. And I use it every day. But there is one minor thing, that
bugs me a little bit:
I am implementing something on a feature branch. Now I detect a minor
typo/bug/whatever that just needs a one line commit.

But of course I don't want to add that commit to my feature branch.
Instead I'd like to commit that fix directly to another branch (e.g.
master).

Unfortunately that take a lot of steps to make this happen:
- - comitting
- - stashing other changes
- - changing branch
- - cherry-picking commit
- - switching branches back
- - reverting latest commit
- - unstashing changes

I'd love to solve this by having an option for git commit that gives
me the possibility to commit to another branch:


git commit thefixedfile.txt -m "fixed a typo" -b master



Any ideas/hints?


Thanks,

Johannes

- -- 
Johannes Schneider - blog.cedarsoft.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJRe9ttAAoJEAytD9R7Qv6dPakH/2WshAEXM9JW2+OFW/9ZxEeL
IQuE4U1OiIH9BRT9XixHQ0+d+Nay/510nFJw0kLLtOl3wRx1ybMvaennYp17Aqi6
yVnDuYbhIsjQD5lFAueLsfDgZdawmWMEOMf/Sk5pX5GLjo9k9+mi/J3KDCqH89Dc
FofgMVsZcXtFB7WS9YzzabOhfomIWhY48R8CblSatzB/r5R4xsTk6eryAgBZvaIz
d2Rh9a54OVRBGeGX3mdgIgVWRHbquU+b1h4Lm8QraTfNGy4uN0hRtzFb356j7xq9
UlA3CqW+w6lyBK14fdQ232jgRTkAPfgms0IShtD9UgBV0o+RBTe1Oa9abZ7sskY=
=J4Dg
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Making a (quick) commit to another branch
  2013-04-27 14:06 Making a (quick) commit to another branch Johannes Schneider
@ 2013-04-27 14:21 ` Javier Domingo
  2013-04-27 14:56   ` Patrik Gornicz
  2013-04-27 21:06   ` Johannes Schneider
  0 siblings, 2 replies; 4+ messages in thread
From: Javier Domingo @ 2013-04-27 14:21 UTC (permalink / raw)
  To: Johannes Schneider; +Cc: git@vger.kernel.org

2013/4/27 Johannes Schneider <mailings@cedarsoft.com>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi guys,
>
> I love git. And I use it every day. But there is one minor thing, that
> bugs me a little bit:
> I am implementing something on a feature branch. Now I detect a minor
> typo/bug/whatever that just needs a one line commit.
>
> But of course I don't want to add that commit to my feature branch.
> Instead I'd like to commit that fix directly to another branch (e.g.
> master).
>
> Unfortunately that take a lot of steps to make this happen:
> - - comitting
> - - stashing other changes
> - - changing branch
> - - cherry-picking commit
> - - switching branches back
> - - reverting latest commit
> - - unstashing changes
>
> I'd love to solve this by having an option for git commit that gives
> me the possibility to commit to another branch:
>
>
> git commit thefixedfile.txt -m "fixed a typo" -b master
>
>
>
> Any ideas/hints?
>

I would first recommend you, instead of cherry-picking the commit, you did this:
-- stash
-- go to the master branch
-- fix the line
-- commit the fix
-- got to the feature branch
-- unstash

As when you merge with master, git will carry on with the changes. I
don't see the need to cherry pick that commit.

Javier Domingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Making a (quick) commit to another branch
  2013-04-27 14:21 ` Javier Domingo
@ 2013-04-27 14:56   ` Patrik Gornicz
  2013-04-27 21:06   ` Johannes Schneider
  1 sibling, 0 replies; 4+ messages in thread
From: Patrik Gornicz @ 2013-04-27 14:56 UTC (permalink / raw)
  To: Javier Domingo; +Cc: git@vger.kernel.org, Johannes Schneider

I've also encountered this desire to quickly fix something in another 
branch.

My need is more driven by the fact that it's a large project and 
stashing changes / switching branches frequently results in 2-6 minute 
build times afterward. Thus the commit to another branch suggestion 
would be quite neat as I wouldn't have to stash/switch.

Another possible approach would be to allow cherry-picking a change 
into another branch (without the stash/switch need).

Either way though, things might be a little weird if there's a 
conflict. Most of the time with the types of changes I'd like to do 
this simply won't be the case so perhaps just failing and requiring the 
user to work around it with either of the suggested work arounds would 
be effective enough . . .

Patrik

On Sat Apr 27 10:21:31 2013, Javier Domingo wrote:
> 2013/4/27 Johannes Schneider <mailings@cedarsoft.com>:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi guys,
>>
>> I love git. And I use it every day. But there is one minor thing, that
>> bugs me a little bit:
>> I am implementing something on a feature branch. Now I detect a minor
>> typo/bug/whatever that just needs a one line commit.
>>
>> But of course I don't want to add that commit to my feature branch.
>> Instead I'd like to commit that fix directly to another branch (e.g.
>> master).
>>
>> Unfortunately that take a lot of steps to make this happen:
>> - - comitting
>> - - stashing other changes
>> - - changing branch
>> - - cherry-picking commit
>> - - switching branches back
>> - - reverting latest commit
>> - - unstashing changes
>>
>> I'd love to solve this by having an option for git commit that gives
>> me the possibility to commit to another branch:
>>
>>
>> git commit thefixedfile.txt -m "fixed a typo" -b master
>>
>>
>>
>> Any ideas/hints?
>>
>
> I would first recommend you, instead of cherry-picking the commit, you did this:
> -- stash
> -- go to the master branch
> -- fix the line
> -- commit the fix
> -- got to the feature branch
> -- unstash
>
> As when you merge with master, git will carry on with the changes. I
> don't see the need to cherry pick that commit.
>
> Javier Domingo
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Making a (quick) commit to another branch
  2013-04-27 14:21 ` Javier Domingo
  2013-04-27 14:56   ` Patrik Gornicz
@ 2013-04-27 21:06   ` Johannes Schneider
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schneider @ 2013-04-27 21:06 UTC (permalink / raw)
  To: Javier Domingo; +Cc: git@vger.kernel.org

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27.04.2013 16:21, Javier Domingo wrote:
> I would first recommend you, instead of cherry-picking the commit,
> you did this: -- stash -- go to the master branch -- fix the line 
> -- commit the fix -- got to the feature branch -- unstash

Yeah, of course u are right.

Thanks for pointing that out - saves me a few key strokes.






> As when you merge with master, git will carry on with the changes.
> I don't see the need to cherry pick that commit.
> 
> Javier Domingo
> 

- -- 
Johannes Schneider - blog.cedarsoft.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJRfD3SAAoJEAytD9R7Qv6duWgH/2BIIuTP0FJTR9Duli+jyzd4
dIicrkwuCCELiOe3XQ2vSgxxr0nUI52Vn0uCRaXwXJqz466/55PGvpNb/COnLUm0
sSDXbQFVPZtb38AZIQvz844pzb5R9DMujp5g/3oA146x7LscPvrWmtSCK6mlGDa5
bm9LUdULP9eMEJ1aJaqDYEDQ/vY/rS/66/c7G2+A1EysxIlW3t3aXLSosv/BGjbF
l2RyHFeV0RsreeA+Aa1ZJoyheMqkDCVKijo/xfBnz7m9OFj12g1moSheD7p2hDJh
UHQU4d9qrHmFcUAhkMe9wIP8Opr98Q7GZOq03p5DaWzWggV2HPcrP8rkmARx2Q8=
=9I4w
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-27 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27 14:06 Making a (quick) commit to another branch Johannes Schneider
2013-04-27 14:21 ` Javier Domingo
2013-04-27 14:56   ` Patrik Gornicz
2013-04-27 21:06   ` Johannes Schneider

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).