Re: Making a (quick) commit to another branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/4/27 Johannes Schneider <mailings@xxxxxxxxxxxxx>:
> -----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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]