git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding a commit to the front of my branch?
@ 2016-01-11 13:36 Robert Dailey
  2016-01-11 14:11 ` Stefan Haller
  2016-01-11 14:16 ` John Keeping
  0 siblings, 2 replies; 7+ messages in thread
From: Robert Dailey @ 2016-01-11 13:36 UTC (permalink / raw)
  To: Git

Normally to add commits on my branch, I perform an interactive rebase:

$ git rebase -i origin/master

I mark the commit I want to put the new commit on top of as 'edit'.
However, if I want to add a commit to the front of my branch, I don't
really have a commit to mark as "edit". I tried to be tricky with
this, and did:

$ git rebase -i origin/master^

However this doesn't work if my merge-base is a merge commit. I get a
ton of superfluous commits in my TODO file.

Is there a built-in mechanism I can use, with relative ease, to
accomplish this goal? At the moment I have to run a series of a couple
of commands to do this, namely mark the oldest commit on my branch as
'edit', reset it, stash it, add new commit, pop stash, commit again,
etc.

Normally I'd add a new tip commit and reorder it to accomplish this,
however commits on my branch already alter this code and I don't want
to create unnecessary conflicts during rebase. The patch needs to be
based on merge-base.

Any advice is greatly appreciated. I'm using Git for Windows 2.7.0.

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

end of thread, other threads:[~2016-01-13 17:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 13:36 Adding a commit to the front of my branch? Robert Dailey
2016-01-11 14:11 ` Stefan Haller
2016-01-13 16:18   ` Robert Dailey
2016-01-13 16:40     ` Stefan Haller
2016-01-13 17:19       ` Robert Dailey
2016-01-11 14:16 ` John Keeping
2016-01-13 16:21   ` Robert Dailey

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