Amend the Last Commit in TortoiseGit Before You Push
Fix a forgotten file or message in your most recent local commit using TortoiseGit's amend option, but only before pushing to a shared branch.
16 Apr 2026, 17:13 UTC

You committed too soon
You just committed a feature branch in TortoiseGit, then noticed a missing file or a typo in the commit message. You can leave the imperfect commit in history, or add a second fix commit that clutters the log. If the commit has not been pushed yet, TortoiseGit can fold the changes into the previous commit instead.
Useful takeaway: use TortoiseGit's amend last commit option to update the most recent local commit before pushing. It rewrites local history only, so it is safe on personal branches but dangerous after sharing.
What amend does under the hood
TortoiseGit is a Windows shell extension for Git. Its Commit dialog includes an option to amend the previous commit; exact labels vary by version. Behind the scenes, this maps to git commit --amend, which replaces the most recent commit object with a new one containing staged changes and an updated message. The branch pointer moves to the new commit, and the old commit becomes unreachable unless Git's reflog, a local log of reference changes, retains it.
Amend is not interactive rebase. It only touches the latest commit. To edit an older commit, use a different workflow.
Worked example: amend a local commit
- Open Windows Explorer and go to your local repository, for example C:\Projects\my-feature.
- Make the forgotten change, then stage the file. In TortoiseGit, right-click the file and choose TortoiseGit > Add, or stage it in the Commit dialog.
- Right-click the repository folder and choose TortoiseGit > Commit.
- In the Commit dialog, enable the amend option. Look for wording such as Amend last commit. Placement depends on your TortoiseGit version.
- Edit the commit message if needed, then click Commit.
Run this in Git Bash or Command Prompt inside the repository to verify:
git log --oneline -3
Expected check: the top commit hash differs from the hash before you amended, while the branch name stays the same. The commit message should reflect your edit.
Permissions and risk: you need write access to the local repository. Amending rewrites history. Do not amend a commit already pushed to a shared remote branch unless your team has agreed to a force push, which overwrites remote history and can break collaborators' checkouts.
Trade-offs and limitations
- TortoiseGit is Windows-only; this workflow does not apply to macOS or Linux.
- Menu labels change between releases. Inspect your installed Commit dialog rather than assuming a specific checkbox location.
- Amend only rewrites the most recent commit. For older commits, use interactive rebase instead.
- If the commit is already on a shared branch, amending requires a force push, which can overwrite others' work.
Check the result and undo if needed
After amending, compare git log --oneline output before and after. The commit hash changes, confirming a new commit object replaced the old one.
If you amend by mistake, inspect the reflog to find the previous commit hash and reset the branch to it. This operation changes state, so use it only when you are certain the old commit is still reachable:
git reflog
git reset --hard <previous-commit-hash>
Closing: amend is a quick way to keep personal feature branches clean before review. Verify locally with git log --oneline, and never amend a pushed commit without coordinating with your team.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.