Improved git workflow with fixup and autosquash (#tilPost)

Who doesn’t know these commits only fixing a typo or removing a log message?
Personally I’m a big fan of the –amend flag to avoid these kind of commits. –amend lets you add changes to the last commit and rewrites it (you have to f…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Who doesn't know these commits only fixing a typo or removing a log message?

Personally I'm a big fan of the --amend flag to avoid these kind of commits. --amend lets you add changes to the last commit and rewrites it (you have to force push afterwards).

But what can you do when you want to fix a commit surrounded by other commits? You could surely do some "git magic" but usually this then is too much effort for me and I take the ugly commit.

My colleague Benedikt recently showed me how they work in the Contentful ecosystem and how they deal with situations that need fixes for commits that are right between several other commits.

The key commands to use are:

  • git commit --fixup <commit>
  • git rebase -i --autosquash

I could now describe how this works but yeah... Florent Lebreton wrote an excellent article on that so just head over there. ;)


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2017-08-09T05:00:00+00:00) Improved git workflow with fixup and autosquash (#tilPost). Retrieved from https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/

MLA
" » Improved git workflow with fixup and autosquash (#tilPost)." Stefan Judis | Sciencx - Wednesday August 9, 2017, https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/
HARVARD
Stefan Judis | Sciencx Wednesday August 9, 2017 » Improved git workflow with fixup and autosquash (#tilPost)., viewed ,<https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » Improved git workflow with fixup and autosquash (#tilPost). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/
CHICAGO
" » Improved git workflow with fixup and autosquash (#tilPost)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/
IEEE
" » Improved git workflow with fixup and autosquash (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/. [Accessed: ]
rf:citation
» Improved git workflow with fixup and autosquash (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2017/08/09/improved-git-workflow-with-fixup-and-autosquash-tilpost/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.