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

Re: [Feature request] An easier way of rebasing if you just want to "force send" a file back to a previous commit

From
11234dev <1234dev@protonmail.com>
Date
Jan 12, 2020, 20:41 UTC
Message-ID
<XqPlWEhzUXEI3NHYcd-yQnaXz7zMf6ycdm9hOZasaDWbWDBvmD3RCjGulYYsftUu6nbS79rvwZp1n1DNMqWgEW3UYWKo5linu1BsyHKScBw=@protonmail.com>
In-Reply-To
<20200112195646.GQ6570@camp.crustytoothpaste.net>
Very cool :-)
Thank you so much for making my life easier! Have a good day :-)

Best regards, Jonathan

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Sunday, January 12, 2020 7:56 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 30 quoted lines
> On 2020-01-12 at 19:42:46, 1234dev wrote:
>
> > Hello!
> > I'm pretty new to all of this, but I was wondering. Is there an easier way of rebasing if you just want to force send a file back to a previous commit? Rebasing can get quite tiresome in the long run. It's like 7 steps, and that's without the merge conflicts someone with my luck is guaranteed to run into.
> > For instance, say I've made changes to a file. Those changes are too tiny and insignificant to make a new commit out of - they actually ought to be part of a commit I made last night.
> > If there just was a way to cheat :) I'm aware it would rewrite my entire history but that's okay, I haven't shared my repo with anybody yet. Maybe something along the lines of "git rebase --off-she-goes <file> <hash>"?
> > As opposed to "git stash && git rebase --interactive '<hash>^' && <change pick => edit> && <apply changes manually> && git add <file> && git commit --amend && git rebase --continue && git stash pop && <merge conflict that requires manual intervention> && git rebase --continue && git stash pop && <still a conflict> && rm <file> && git checkout <file> && <repeat the whole process> && <still a conflict> && <go to IRC and ask for help>
>
> The way I usually handle this is something like the following, although
> I have some helper aliases that wrap this:
>
> git add <file>
> git commit --fixup <hash>
>
> git stash # if necessary
> GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash
>
> That does use the interactive machinery to apply the fixup commit, but
> it also avoids prompting you to edit the interactive TODO list. It
> doesn't avoid the merge conflicts which can occur, but it is (IMO) the
> easiest way to go about it.
>
> If I'd like to edit the message, I use "git commit --squash" to add the
> comments I'd like to add and I'm only prompted to squash together those
> messages.
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> brian m. carlson: Houston, Texas, US
> OpenPGP: https://keybase.io/bk2204
Previous: brian m. carlsonNext: Taylor Blau
Message 3 of 5 in “[Feature request] An easier way of rebasing if you just want to "force send" a file back to a previous commit”
  1. 1234devJan 12, 2020
  2. brian m. carlsonJan 12, 2020
  3. 1234devJan 12, 2020
  4. Taylor BlauJan 12, 2020
  5. 1234devJan 13, 2020

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.