Re: Adding a commit to the front of my branch?

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

 



On Mon, Jan 11, 2016 at 07:36:25AM -0600, Robert Dailey wrote:
> 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.

Have you considered creating a new (temporary) branch based on master,
adding the new commit there and inserting "pick $new_commit_sha1" at the
start of the instruction sheet when rebasing the original branch?
--
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]