You are not logged in.
I've created https://gitlab.freedesktop.org/mesa/mes … ests/41555 to solve an issue.
The branch currently has 1 commit and I've ben asked to change commit message and title.
Deleting the branch and recreating it will lead to deletion of the current MR .
Git reset seems to add a new commit that reverts the changes done by the first. If I add a new imporved one that's 3 commits .
git revert may be suitable to get rid of the old commit but requires to force push. Not sure oif that's allowed for forks but it doesn't feel right.
man git commit lists an amend option which may be just what I need.
Is that correct or is there a better method ?
Last edited by Lone_Wolf (2026-05-17 11:04:24)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Yes, `git commit --amend` is the correct option to change the contents and/or commit message for the most recent commit. Note that, after amending the commit, you will need to pass the `--force` option to `git push` in order to overwrite the old version of the commit on the server.
Offline
Amend is what I'd use in this situation, however, if there was more than one commit to change, you can use rebase interactively to achieve that, e.g.
$ git rebase -i HEAD~4Will open $EDITOR with the last four commits listed, and instructions on how to interact with them. In this case you'd want to change the 'pick' to 'reword' on the relevant commit lines, then save and exit $EDITOR. git would then rebase the commits and open $EDITOR again for the ones that you specified you wanted to modify the commit message for.
pick 9c264bd # Add the dumplings
pick b8f8ba6 # Update job
pick 6ef3b28 # Update links, replace github with codeberg
pick 9b2f6d1 # Added factorio screenie
# Rebase 18b7210..9b2f6d1 onto 18b7210 (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# create a merge commit using the original merge commit's
# message (or the oneline, if no original merge commit was
# specified); use -c <commit> to reword the commit message
# u, update-ref <ref> = track a placeholder for the <ref> to be updated
# to this position in the new commits. The <ref> is
# updated at the end of the rebase
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I'm beginning to understand how those commands work, but made the mistake of updating the fork before using amends .
Now git rebase -i HEAD~2 does show the commit I want to change, but also 80 others ....
After making the changes and finishing the rebase git status reports
$ git status
On branch LLVM23-MCSubtargetInfo
Your branch and 'origin/LLVM23-MCSubtargetInfo' have diverged,
and have 80 and 81 different commits each, respectively.
(use "git pull" if you want to integrate the remote branch with yours)
nothing to commit, working tree cleanDo I need to change those 80 commits from pick to drop ?
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
When you say you "updated the fork," what exactly did you do? Did you merge in new changes from the main branch?
Assuming that's what you did, and that your local `main` branch is fully up to date with the upstream `main`, one way to fix things is:
Check out your MR branch: `git checkout LLVM23-MCSubtargetInfo`
Run `git log`, find the one commit you're making on this branch, and copy its hash
Run `git reset --hard main` to make the branch point at the most recent commit to the upstream repo
Run `git cherry-pick $hash`, where `$hash` is the hash of the commit you copied down; this will reapply your commit on top of the latest main
Run `git commit --amend` to finally fix the commit message
If any of these steps fail, you should be able to do `git reset --hard origin/LLVM23-MCSubtargetInfo` to set your MR branch back to how it was before these steps.
If the steps all work out, you'll need to `git push --force` to update the branch on gitlab.freedesktop.org.
Offline
git rebase -i main # this will get rid of the merge that pulled in 80 commits and instead rebase your single commit onto the current main branchpick ca647d3edfa # adjust to change in https://github.com/llvm/llvm-project/com>
# Rebase e76abd1e3a6..cd4facf4c44 onto e76abd1e3a6 (1 command)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# create a merge commit using the original merge commit'sHere change pick to reword as you only want to change the commit message.
Offline
Took some experimenting, but the inputs did allow me to solve he issue for MR 41555 .
I tried to do similar with MR 41558 but that didn't do what I expected/wanted .
commands
$ git checkout LLVM23-lookupTarget
branch 'LLVM23-lookupTarget' set up to track 'origin/LLVM23-lookupTarget'.
Switched to a new branch 'LLVM23-lookupTarget'
$ git pull
Already up to date.
$ git commit --amend
[LLVM23-lookupTarget f72939344a4] clc: fix build woith LLVM23 (TargetRegistry::lookupTarget)
Date: Wed May 13 22:54:45 2026 +0200
1 file changed, 5 insertions(+), 1 deletion(-)
$ git push --force
Username for 'https://gitlab.freedesktop.org': Lone_Wolf
Password for 'https://Lone_Wolf@gitlab.freedesktop.org':
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 32 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 699 bytes | 699.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0), pack-reused 0 (from 0)
remote:
remote: View merge request for LLVM23-lookupTarget:
remote: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41558
remote:
To https://gitlab.freedesktop.org/Lone_Wolf/mesa.git
+ e5ba5c863d1...f72939344a4 LLVM23-lookupTarget -> LLVM23-lookupTarget (forced update)
$ git rebase -i main
Successfully rebased and updated refs/heads/LLVM23-lookupTarget.
$ git status
On branch LLVM23-lookupTarget
Your branch and 'origin/LLVM23-lookupTarget' have diverged,
and have 79 and 1 different commits each, respectively.
(use "git pull" if you want to integrate the remote branch with yours)
nothing to commit, working tree clean
$ git pull
Merge made by the 'ort' strategy.
[panoramix@mjoelnir mesa]$ git push --force
Username for 'https://gitlab.freedesktop.org': Lone_Wolf
Password for 'https://Lone_Wolf@gitlab.freedesktop.org':
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 32 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 773 bytes | 773.00 KiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0 (from 0)
remote:
remote: View merge request for LLVM23-lookupTarget:
remote: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41558
remote:
To https://gitlab.freedesktop.org/Lone_Wolf/mesa.git
f72939344a4..ab1a92313e8 LLVM23-lookupTarget -> LLVM23-lookupTarget
$ Currently there are 3 commits in that MR instead of 1.
git commit --amend
git push --force
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Currently there are 3 commits in that MR instead of 1.
That is because you pulled into the current branch followed by force push.
git pull origin main # update main not the current branch
git rebase -i main # this will get rid of the merge
git push --forceEdit:
PS there is a type in the commit message 'woith'
Last edited by loqs (2026-05-16 16:17:15)
Offline
My local copy was screwed up, even git switch didn't work but after deleting it and re-cloning the fork it did work.
Both MRs are now fine and as I want them, waiting for input from upstream.
Thanks for all the help, marking as [Solved]
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline