{"thread":{"id":"52621","subject":"[Feature request] An easier way of rebasing if you just want to \"force send\" a file back to a previous commit","startedAt":"2020-01-12T19:42:55Z","lastAt":"2020-01-13T14:13:42Z","messageCount":5,"participants":["1234dev","brian m. carlson","Taylor Blau"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"389636","messageId":"jvRjyPq1IXAbIqfIOfEu2KxNKCMq9ktnAlVF9jGrccIvlPt22V62Ic8j0dHvLDOS31YrHZ2_t8ldgUTgJQHGdsMiYhnpYJJmOlJQFwiif_8=@protonmail.com","threadId":"52621","inReplyTo":null,"subject":"[Feature request] An easier way of rebasing if you just want to \"force send\" a file back to a previous commit","fromName":"1234dev","fromEmail":"1234dev@protonmail.com","sentAt":"2020-01-12T19:42:46Z","receivedAt":"2020-01-12T19:42:55Z","isPatch":false,"sender":{"key":"1234dev@protonmail.com","avatar":null},"body":"Hello!\n\nI'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.\n\nFor 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.\n\nIf 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>\"?\n\nAs 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>\n\nMight have gotten the above sequence of commands a bit wrong, I just learned how to rebase a few days ago. But hopefully y'all get my point.\n\nThanks!\n\n\nSent with ProtonMail Secure Email.\n\n\n"},{"id":"389638","messageId":"20200112195646.GQ6570@camp.crustytoothpaste.net","threadId":"52621","inReplyTo":"jvRjyPq1IXAbIqfIOfEu2KxNKCMq9ktnAlVF9jGrccIvlPt22V62Ic8j0dHvLDOS31YrHZ2_t8ldgUTgJQHGdsMiYhnpYJJmOlJQFwiif_8=@protonmail.com","subject":"Re: [Feature request] An easier way of rebasing if you just want to \"force send\" a file back to a previous commit","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-01-12T19:56:46Z","receivedAt":"2020-01-12T19:56:55Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-01-12 at 19:42:46, 1234dev wrote:\n> Hello!\n> \n> 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.\n> \n> 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.\n> \n> 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>\"?\n> \n> 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>\n\nThe way I usually handle this is something like the following, although\nI have some helper aliases that wrap this:\n\n  git add <file>\n  git commit --fixup <hash>\n  git stash # if necessary\n  GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n\nThat does use the interactive machinery to apply the fixup commit, but\nit also avoids prompting you to edit the interactive TODO list.  It\ndoesn't avoid the merge conflicts which can occur, but it is (IMO) the\neasiest way to go about it.\n\nIf I'd like to edit the message, I use \"git commit --squash\" to add the\ncomments I'd like to add and I'm only prompted to squash together those\nmessages.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"389639","messageId":"XqPlWEhzUXEI3NHYcd-yQnaXz7zMf6ycdm9hOZasaDWbWDBvmD3RCjGulYYsftUu6nbS79rvwZp1n1DNMqWgEW3UYWKo5linu1BsyHKScBw=@protonmail.com","threadId":"52621","inReplyTo":"20200112195646.GQ6570@camp.crustytoothpaste.net","subject":"Re: [Feature request] An easier way of rebasing if you just want to \"force send\" a file back to a previous commit","fromName":"1234dev","fromEmail":"1234dev@protonmail.com","sentAt":"2020-01-12T20:41:04Z","receivedAt":"2020-01-12T20:41:16Z","isPatch":false,"sender":{"key":"1234dev@protonmail.com","avatar":null},"body":"Very cool :-)\n\nThank you so much for making my life easier! Have a good day :-)\n\nBest regards,\nJonathan\n\n\nSent with ProtonMail Secure Email.\n\n‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐\nOn Sunday, January 12, 2020 7:56 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:\n\n> On 2020-01-12 at 19:42:46, 1234dev wrote:\n>\n> > Hello!\n> > 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.\n> > 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.\n> > 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>\"?\n> > 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>\n>\n> The way I usually handle this is something like the following, although\n> I have some helper aliases that wrap this:\n>\n> git add <file>\n> git commit --fixup <hash>\n>\n> git stash # if necessary\n> GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n>\n> That does use the interactive machinery to apply the fixup commit, but\n> it also avoids prompting you to edit the interactive TODO list. It\n> doesn't avoid the merge conflicts which can occur, but it is (IMO) the\n> easiest way to go about it.\n>\n> If I'd like to edit the message, I use \"git commit --squash\" to add the\n> comments I'd like to add and I'm only prompted to squash together those\n> messages.\n>\n> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n>\n> brian m. carlson: Houston, Texas, US\n> OpenPGP: https://keybase.io/bk2204\n\n\n"},{"id":"389640","messageId":"20200112204511.GA4400@syl.local","threadId":"52621","inReplyTo":"20200112195646.GQ6570@camp.crustytoothpaste.net","subject":"Re: [Feature request] An easier way of rebasing if you just want to \"force send\" a file back to a previous commit","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2020-01-12T20:45:11Z","receivedAt":"2020-01-12T20:45:18Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Sun, Jan 12, 2020 at 07:56:46PM +0000, brian m. carlson wrote:\n> On 2020-01-12 at 19:42:46, 1234dev wrote:\n> > Hello!\n> >\n> > 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.\n> >\n> > 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.\n> >\n> > 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>\"?\n> >\n> > 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>\n>\n> The way I usually handle this is something like the following, although\n> I have some helper aliases that wrap this:\n>\n>   git add <file>\n>   git commit --fixup <hash>\n>   git stash # if necessary\n>   GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n>\n> That does use the interactive machinery to apply the fixup commit, but\n> it also avoids prompting you to edit the interactive TODO list.  It\n> doesn't avoid the merge conflicts which can occur, but it is (IMO) the\n> easiest way to go about it.\n\nI couldn't quite tell one way or the other, but I think that the\noriginal poster was asking about the case in which one wants to move\nsome hunks out of one commit and into an earlier one.\n\nI usually go about this with something like:\n\n  h=\"$(git rev-parse HEAD)\"\n  git reset HEAD^\n  git add <file[s]> # re-stage the files that you want to move \"up\"\n  git commit --fixup <hash>\n  git add --all .\n  git commit -C \"$h\" # \"re-apply\" the commit that you were moving out of\n  GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n\n> If I'd like to edit the message, I use \"git commit --squash\" to add the\n> comments I'd like to add and I'm only prompted to squash together those\n> messages.\n\nMy preference is usually to allow 'git rebase -i' to open my \"$EDITOR\"\nand change the todo list to \"reword\" for any commit(s) for which I want\nto change the message.\n\n> --\n> brian m. carlson: Houston, Texas, US\n> OpenPGP: https://keybase.io/bk2204\n\nThanks,\nTaylor\n"},{"id":"389715","messageId":"0Dqok-9TKEiBBNX9nxLHb5JpKGVBSbtanPqn_LsLttvk1KIrdc6TEffERFUJ-TApxkB1CHZ7vmexHGYG9KMe6gC9nhTJXOJM7egKDQ8y6HU=@protonmail.com","threadId":"52621","inReplyTo":"20200112204511.GA4400@syl.local","subject":"Re: [Feature request] An easier way of rebasing if you just want to \"force send\" a file back to a previous commit","fromName":"1234dev","fromEmail":"1234dev@protonmail.com","sentAt":"2020-01-13T14:13:33Z","receivedAt":"2020-01-13T14:13:42Z","isPatch":false,"sender":{"key":"1234dev@protonmail.com","avatar":null},"body":"Hi,\n\nOn Sunday, January 12, 2020 8:45 PM, Taylor Blau <me@ttaylorr.com> wrote:\n>\n> I couldn't quite tell one way or the other, but I think that the\n> original poster was asking about the case in which one wants to move\n> some hunks out of one commit and into an earlier one.\n>\n> I usually go about this with something like:\n>\n> h=\"$(git rev-parse HEAD)\"\n> git reset HEAD^\n> git add <file[s]> # re-stage the files that you want to move \"up\"\n> git commit --fixup <hash>\n> git add --all .\n> git commit -C \"$h\" # \"re-apply\" the commit that you were moving out of\n> GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n\nI was just looking for a simpler way to either move the entire file back to a certain commit, other than the standard way of rebasing. Your suggestion looks even more complicated than the method I currently use which kinda defeats the purpose.\n\nI appreciate the help though!\n\nAll the best,\nJonathan\n\n\nSent with ProtonMail Secure Email.\n\n‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐\nOn Sunday, January 12, 2020 8:45 PM, Taylor Blau <me@ttaylorr.com> wrote:\n\n> On Sun, Jan 12, 2020 at 07:56:46PM +0000, brian m. carlson wrote:\n>\n> > On 2020-01-12 at 19:42:46, 1234dev wrote:\n> >\n> > > Hello!\n> > > 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.\n> > > 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.\n> > > 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>\"?\n> > > 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>\n> >\n> > The way I usually handle this is something like the following, although\n> > I have some helper aliases that wrap this:\n> > git add <file>\n> > git commit --fixup <hash>\n> > git stash # if necessary\n> > GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n> > That does use the interactive machinery to apply the fixup commit, but\n> > it also avoids prompting you to edit the interactive TODO list. It\n> > doesn't avoid the merge conflicts which can occur, but it is (IMO) the\n> > easiest way to go about it.\n>\n> I couldn't quite tell one way or the other, but I think that the\n> original poster was asking about the case in which one wants to move\n> some hunks out of one commit and into an earlier one.\n>\n> I usually go about this with something like:\n>\n> h=\"$(git rev-parse HEAD)\"\n> git reset HEAD^\n> git add <file[s]> # re-stage the files that you want to move \"up\"\n> git commit --fixup <hash>\n> git add --all .\n> git commit -C \"$h\" # \"re-apply\" the commit that you were moving out of\n> GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash\n>\n> > If I'd like to edit the message, I use \"git commit --squash\" to add the\n> > comments I'd like to add and I'm only prompted to squash together those\n> > messages.\n>\n> My preference is usually to allow 'git rebase -i' to open my \"$EDITOR\"\n> and change the todo list to \"reword\" for any commit(s) for which I want\n> to change the message.\n>\n> > --\n> > brian m. carlson: Houston, Texas, US\n> > OpenPGP: https://keybase.io/bk2204\n>\n> Thanks,\n> Taylor\n\n\n"}]}