git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Commit to other branch
@ 2010-05-31 15:46 Johannes Schneider
  2010-05-31 16:28 ` Matthieu Moy
  2010-06-06 18:43 ` Jan Hudec
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schneider @ 2010-05-31 15:46 UTC (permalink / raw)
  To: Git Mailing List

Hi guys,

I often run in that scenario:
I see a small bugfix/typo/missing documentation. Of course I just add a
bit of code to fix that issue...
Then I'd like to commit that change as own commit. And most of the time
this is possible without any problems (git commit <file>).
But as I am *always* working on a topic branch, it takes some work to
commit that change to another branch.

I tried to "git stash "
But then *all* changes are stashed (including my changes)...

So at the moment I do that:

git commit <file> (on wrong branch)
git stash
git checkout pu
git cherry-pick
git checkout my-topic
git reset --hard
git stash apply

And that is much to much work. I just want to do something like that:

git commit <file> -b pu

But I don't think that is possible at the moment... Any hints, how I
could solve that? How do you do that?


Thanks,

Johannes

-- 
Johannes Schneider - blog.cedarsoft.com

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

* Re: Commit to other branch
  2010-05-31 15:46 Commit to other branch Johannes Schneider
@ 2010-05-31 16:28 ` Matthieu Moy
  2010-05-31 23:50   ` Jeff King
  2010-06-06 18:43 ` Jan Hudec
  1 sibling, 1 reply; 4+ messages in thread
From: Matthieu Moy @ 2010-05-31 16:28 UTC (permalink / raw)
  To: Johannes Schneider; +Cc: Git Mailing List

Johannes Schneider <mailings@cedarsoft.com> writes:

> I tried to "git stash "
> But then *all* changes are stashed (including my changes)...

Not completely answering the question, but "git stash -k"
(--keep-index) allows you to do a selective stash. If you have
relevant changes staged, and want to commit the unstaged ones
elsewhere, you can do something like

git stash -k
git checkout elsewhere
git commit
git checkout back-to-your-branch
git stash pop

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: Commit to other branch
  2010-05-31 16:28 ` Matthieu Moy
@ 2010-05-31 23:50   ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2010-05-31 23:50 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Johannes Schneider, Git Mailing List

On Mon, May 31, 2010 at 06:28:48PM +0200, Matthieu Moy wrote:

> Johannes Schneider <mailings@cedarsoft.com> writes:
> 
> > I tried to "git stash "
> > But then *all* changes are stashed (including my changes)...
> 
> Not completely answering the question, but "git stash -k"
> (--keep-index) allows you to do a selective stash. If you have

Also, recent versions of git have "git stash -p" to interactively stash
just a few changes.

-Peff

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

* Re: Commit to other branch
  2010-05-31 15:46 Commit to other branch Johannes Schneider
  2010-05-31 16:28 ` Matthieu Moy
@ 2010-06-06 18:43 ` Jan Hudec
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Hudec @ 2010-06-06 18:43 UTC (permalink / raw)
  To: Johannes Schneider; +Cc: Git Mailing List

On Mon, May 31, 2010 at 17:46:09 +0200, Johannes Schneider wrote:
> I often run in that scenario:
> I see a small bugfix/typo/missing documentation. Of course I just add a
> bit of code to fix that issue...
> Then I'd like to commit that change as own commit. And most of the time
> this is possible without any problems (git commit <file>).
> But as I am *always* working on a topic branch, it takes some work to
> commit that change to another branch.

What I'd probably do is just commit the quick fix, as separate commit, where
I am. Than when I'd have a bit of time (probably when I'd otherwise think of
rebasing on master anyway) I'd rebase -i all such fixes to the bottom of the
topic branch, go to master and merge just those fixes. The rebase -i can be
against current master, so the merge back would be fast-forward, of course.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

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

end of thread, other threads:[~2010-06-06 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 15:46 Commit to other branch Johannes Schneider
2010-05-31 16:28 ` Matthieu Moy
2010-05-31 23:50   ` Jeff King
2010-06-06 18:43 ` Jan Hudec

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).