{"thread":{"id":"66077","subject":"REBASE_HEAD still exists after success end rebase","startedAt":"2026-07-28T08:41:48Z","lastAt":"2026-07-28T15:44:14Z","messageCount":6,"participants":["Long 76","Matt Hunter","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"549113","messageId":"edfc868b-6be6-4871-a539-e70791db216d@mail.ru","threadId":"66077","inReplyTo":null,"subject":"REBASE_HEAD still exists after success end rebase","fromName":"Long 76","fromEmail":"long76.git@mail.ru","sentAt":"2026-07-28T08:26:29Z","receivedAt":"2026-07-28T08:41:48Z","isPatch":false,"body":"Hi,\nMy configuration:\nOS Kubuntu 24.04\nGit version: 2.54.0 from ppa:git-core/ppa\n\n.gitconfig\n[merge]\n     guitool = meld\n     tool = meld\n[core]\n     editor = code -w\n     autocrlf = input\n     quotePath = false\n     eol = lf\n\n[global]\n[diff]\n     tool = meld\n[gui]\n     editor = code\n[fetch]\n     prune = true\n[mergetool]\n     keepBackup = false\n\nHow to reproduce:\n1) Made repo\n# Init repo with README.md\ngit init\necho -e '# Git rebase bug\\n\\n```\\ngit rebase master\\ngit mergetool\\ngit \nrebase --continue\\ngit rev-parse REBASE_HEAD\\n```' > README.md\ngit add README.md\ngit commit -m \"docs: add README.md\"\n\n# Add feature branch\ngit branch feature_branch\n\n# Add files in separate commits\necho -e \"Text 1 line\\nText 2 line\\nText 3 line\\nText 4 line\\nText 5 \nline\" > Text1.txt\ngit add Text1.txt\ngit commit -m \"feat: add Text1.txt\"\n\necho -e \"Text 1 line\\nText 2 line\\nText 3 line\\nText 4 line\\nText 5 \nline\" > Text2.txt\ngit add Text2.txt\ngit commit -m \"feat: add Text2.txt\"\n\necho -e \"Text 1 line\\nText 2 line\\nText 3 line\\nText 4 line\\nText 5 \nline\" > Text3.txt\ngit add Text3.txt\ngit commit -m \"feat: add Text3.txt\"\n\n# Do the same in feature branch and one more in one commit\ngit checkout feature_branch\necho -e \"Texts 1 line\\nTexts 2 line\\nTexts 3 line\\nText 4 line\\nTexts 5 \nline\" > Text1.txt\ngit add Text1.txt\n\necho -e \"Text 1 line\\nText 2 line\\nText 3 line\\nText 4 line\\nText 5 \nline\" > Text2.txt\ngit add Text2.txt\n\necho -e \"Texts 1 line\\nTexts 2 line\\nTexts 3 line\\nText 4 line\\nTexts 5 \nline\" > Text3.txt\ngit add Text3.txt\n\necho -e \"Texts 1 line\\nTexts 2 line\\nText 3 line\\nTexts 4 line\\nText 5 \nline\" > Text4.txt\ngit add Text4.txt\ngit commit -m \"feat: add all files\"\n2) Call — git rebase master\n3) Call — git mergetool\n4) Call — git rebase --continue\n5) Call — git rev-parse REBASE_HEAD\nLast command return value and .git/REBASE_HEAD exists.\nIn other words REBASE_HEAD exists if ogirinal commit in new branch \nmodified and need call git push --force to send it to server. Please fix \nit, thanks!\n\n--\nLong76\n"},{"id":"549117","messageId":"DKA3RP12A8LU.2VD89MQ7G2KLL@lfurio.us","threadId":"66077","inReplyTo":"edfc868b-6be6-4871-a539-e70791db216d@mail.ru","subject":"Re: REBASE_HEAD still exists after success end rebase","fromName":"Matt Hunter","fromEmail":"m@lfurio.us","sentAt":"2026-07-28T09:39:11Z","receivedAt":"2026-07-28T09:39:18Z","isPatch":false,"body":"On Tue Jul 28, 2026 at 4:26 AM EDT, Long 76 wrote:\n>\n> In other words REBASE_HEAD exists if ogirinal commit in new branch \n> modified and need call git push --force to send it to server. Please fix \n> it, thanks!\n\nI ran into this not that long ago too, while working on a script.  It\nlooked like this behavior depended on how the _last_ item in the rebase\ntodo list was handled.  I found if the last action was a squash or edit\n(I don't think reword did this), then REBASE_HEAD was left behind.\n\nAlso, if rebase stops on a break command, then REBASE_HEAD will be\nmissing, even though a rebase is still in-progress.\n\nI made a very short-lived effort to look into why this \"bug\" was\nhappening.  I say \"bug\" in quotes, because I'm not even sure if it is\neven problematic behavior.\n\nI solved my need at the time (detecting a rebase in progress) by\nchecking for the existence of either of the 'rebase-merge' or\n'rebase-apply' directories in $GIT_DIR.\n>\n> --\n> Long76\n"},{"id":"549124","messageId":"92a69a99-c56f-4ec5-968f-436bef64ee48@gmail.com","threadId":"66077","inReplyTo":"DKA3RP12A8LU.2VD89MQ7G2KLL@lfurio.us","subject":"Re: REBASE_HEAD still exists after success end rebase","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-07-28T13:21:05Z","receivedAt":"2026-07-28T13:21:08Z","isPatch":false,"body":"On 28/07/2026 10:39, Matt Hunter wrote:\n> On Tue Jul 28, 2026 at 4:26 AM EDT, Long 76 wrote:\n>>\n>> In other words REBASE_HEAD exists if ogirinal commit in new branch\n>> modified and need call git push --force to send it to server. Please fix\n>> it, thanks!\n\nThe need for \"--force\" when pushing is due to you having rebased the \nbranch, it is unrelated to the existence of REBASE_HEAD (other than the \nfact that it exists indicates you have rebased). Rebasing rewrites the \nhistory which means that the remote cannot fast-forward when you push. \nRather than using \"--force\" I'd recommend \"--force-with-lease \n--force-if-includes\" instead (see the \"git push\" man page for more details).\n\n> I ran into this not that long ago too, while working on a script.  It\n> looked like this behavior depended on how the _last_ item in the rebase\n> todo list was handled.  I found if the last action was a squash or edit\n> (I don't think reword did this), then REBASE_HEAD was left behind.\n> \n> Also, if rebase stops on a break command, then REBASE_HEAD will be\n> missing, even though a rebase is still in-progress.\n> \n> I made a very short-lived effort to look into why this \"bug\" was\n> happening.  I say \"bug\" in quotes, because I'm not even sure if it is\n> even problematic behavior.\n\nI think leaving REBASE_HEAD behind after a rebase is a bug, albeit not a \nvery serious one. Looking at the code we delete it before processing \neach command, but do not clean it up after the last command.\n\n> I solved my need at the time (detecting a rebase in progress) by\n> checking for the existence of either of the 'rebase-merge' or\n> 'rebase-apply' directories in $GIT_DIR.\n\nThat's the best way to detect if a rebase is in progress - REBASE_HEAD \nonly exists when there are conflicts, or the editor is opened for the \nuser to reword a commit. It does not exist when the user is editing the \ntodo list at the start of a rebase; when stopping for conflicts after a \n\"merge parent\" command without \"-C\"; when stopping for a break or failed \nexec command.\n\nThanks\n\nPhillip\n"},{"id":"549138","messageId":"b19319a0-a248-4213-ab03-b1abb4a42744@mail.ru","threadId":"66077","inReplyTo":"92a69a99-c56f-4ec5-968f-436bef64ee48@gmail.com","subject":"Re: REBASE_HEAD still exists after success end rebase","fromName":"Long 76","fromEmail":"long76.git@mail.ru","sentAt":"2026-07-28T15:34:07Z","receivedAt":"2026-07-28T15:34:16Z","isPatch":false,"body":"> The need for \"--force\" when pushing is due to you having rebased the \n> branch, it is unrelated to the existence of REBASE_HEAD (other than the \n> fact that it exists indicates you have rebased). Rebasing rewrites the \n> history which means that the remote cannot fast-forward when you push. \n> Rather than using \"--force\" I'd recommend \"--force-with-lease --force- \n> if-includes\" instead (see the \"git push\" man page for more details).\n\nI know it, commit don't the same that was before rebase - because of the \nconflict, it had to be changed.\n\n\n"},{"id":"549141","messageId":"9ee7b916-a9ce-4300-baf4-b24d0a52fe46@mail.ru","threadId":"66077","inReplyTo":"DKA3RP12A8LU.2VD89MQ7G2KLL@lfurio.us","subject":"Re: REBASE_HEAD still exists after success end rebase","fromName":"Long 76","fromEmail":"long76.git@mail.ru","sentAt":"2026-07-28T15:27:51Z","receivedAt":"2026-07-28T15:43:10Z","isPatch":false,"body":"> I made a very short-lived effort to look into why this \"bug\" was\n> happening.  I say \"bug\" in quotes, because I'm not even sure if it is\n> even problematic behavior.\n\nI think this is a bug because git create similar HEADs if you made merge \nor cherry-pick. I don't have problems with them.\n\nPlus by git rebase docs on official site flag '--show-current-patch':\n---\nShow the current patch in an interactive rebase or when rebase is \nstopped because of conflicts. This is the equivalent of git show \nREBASE_HEAD.\n---\nFor me it means that return patch only if rebase in progress - not \naborted/not complete/have conflicts\n\n> I solved my need at the time (detecting a rebase in progress) by\n> checking for the existence of either of the 'rebase-merge' or\n> 'rebase-apply' directories in $GIT_DIR.\n\nThanks for advice! I don't knew it.\n"},{"id":"549142","messageId":"b3ec5eac-a177-4991-8edc-36ce5992dad2@mail.ru","threadId":"66077","inReplyTo":"9ee7b916-a9ce-4300-baf4-b24d0a52fe46@mail.ru","subject":"Re: REBASE_HEAD still exists after success end rebase","fromName":"Long 76","fromEmail":"long76.git@mail.ru","sentAt":"2026-07-28T15:28:55Z","receivedAt":"2026-07-28T15:44:14Z","isPatch":false,"body":"+ phillip.wood@dunelm.org.uk\n\n28.07.2026 18:27, Long 76 пишет:\n>> I made a very short-lived effort to look into why this \"bug\" was\n>> happening.  I say \"bug\" in quotes, because I'm not even sure if it is\n>> even problematic behavior.\n> \n> I think this is a bug because git create similar HEADs if you made merge \n> or cherry-pick. I don't have problems with them.\n> \n> Plus by git rebase docs on official site flag '--show-current-patch':\n> ---\n> Show the current patch in an interactive rebase or when rebase is \n> stopped because of conflicts. This is the equivalent of git show \n> REBASE_HEAD.\n> ---\n> For me it means that return patch only if rebase in progress - not \n> aborted/not complete/have conflicts\n> \n>> I solved my need at the time (detecting a rebase in progress) by\n>> checking for the existence of either of the 'rebase-merge' or\n>> 'rebase-apply' directories in $GIT_DIR.\n> \n> Thanks for advice! I don't knew it.\n\n"}]}