git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Jan 13, 2016, 17:19 UTC
Message-ID
<CAHd499A67diDmBB3cO_SYXNaZnohcxNtaQpmDAomwToG+MMOvw@mail.gmail.com>
In-Reply-To
<1mgz4yx.94yt5g12q9hidM%lists@haller-berlin.de>
On Wed, Jan 13, 2016 at 10:40 AM, Stefan Haller <lists@haller-berlin.de> wrote:
Show 26 quoted lines
> Robert Dailey <rcdailey.lists@gmail.com> wrote:
>
>> On Mon, Jan 11, 2016 at 8:11 AM, Stefan Haller <lists@haller-berlin.de> wrote:
>> > Robert Dailey <rcdailey.lists@gmail.com> 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".
>> >
>> > Instead of marking commits as edit, I usually add "x false" at the place
>> > where I want to add a commit. With this I find it easier to see where
>> > the new commit goes, and it also works before the first commit.
>>
>> What do you mean "x false"? I'm not familiar with this. Can you explain?
>
> "x" is a shorthand for "exec" (just like "p" is a shorthand for "pick",
> for instance). "exec" will execute an arbitrary shell command, and stop
> when that shell command fails with an exit code not equal to zero.
> "false" is a shell command that does nothing except return a non-zero
> exit code, so "x false" just stops and waits for you to "fix" something.
> At that point you can make additional commits, and then "git rebase
> --continue" to go on.

Oh, this is pretty neat! So I assume it will stop BEFORE a patch is applied, unlike edit? I will try this next time. However it would be great to see a new 'insert' command for the TODO file, that will let you insert a commit at that point (i.e. it stops before the marked commit is applied).

Thanks for the help.
Previous: Stefan HallerNext: John Keeping
Message 5 of 7 in “Adding a commit to the front of my branch?”
  1. Robert DaileyJan 11, 2016
  2. Stefan HallerJan 11, 2016
  3. Robert DaileyJan 13, 2016
  4. Stefan HallerJan 13, 2016
  5. Robert DaileyJan 13, 2016
  6. John KeepingJan 11, 2016
  7. Robert DaileyJan 13, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.