Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: auto-fixup a commit in a feature branch

Tags:

git

rebase

When I am done with a feature, often what I would like is to auto-fixup a commit followed by a force-push to a remote origin before a merge to master.

I end up rebasing on top of master so I can fixup a commit, because I found a tiny thing I want to change and I don't want that change as a separate commit. So I rebase interactively, I fixup the last commit, then I force push. Is there a way to do that in one step?

like image 559
naimdjon Avatar asked Aug 25 '26 06:08

naimdjon


1 Answers

You can save the step of editing the list of commits manually in rebase -i using git commit --fixup <commit> when making your fixup commit. Then, if rebase.autoSquash is set to true, git rebase -i will automatically turn the line containing this commit into a fixup line right below the commit to fix.

like image 91
Matthieu Moy Avatar answered Aug 26 '26 21:08

Matthieu Moy