From: Patrik Gornicz <patrik-git@mail.pgornicz.com>
To: Javier Domingo <javierdo1@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Johannes Schneider <mailings@cedarsoft.com>
Subject: Re: Making a (quick) commit to another branch
Date: Sat, 27 Apr 2013 10:56:39 -0400 [thread overview]
Message-ID: <517BE727.1050000@mail.pgornicz.com> (raw)
In-Reply-To: <CALZVap=9Z=0DPM1fNwotn3sN-W7mXMPRSJ2aY5jzkQTBD6v=Kw@mail.gmail.com>
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
next prev parent reply other threads:[~2013-04-27 15:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2013-04-27 21:06 ` Johannes Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=517BE727.1050000@mail.pgornicz.com \
--to=patrik-git@mail.pgornicz.com \
--cc=git@vger.kernel.org \
--cc=javierdo1@gmail.com \
--cc=mailings@cedarsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).