Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
In this specific case I don't see a downside of using git commit --amend (unless you've already pushed), so why not use it?
Having an unclean commit history is not too harmful, all things considered, so you don't need to be perfect with it. However, a clean commit history provides some benefits:
Can revert to any previous commit and it will be stable, so there is less risk when reverting.
Can help you debug by narrowing down the bad code by finding the commit where the bug originated. You can use git bisect or find the commit manually.
Smaller commits can help even more with reverting, as you won't lose as many changes when you revert, and with debugging, as the bad code will be narrowed down further.
Easy to read back and understand the history of the codebase and features.
Easier to code review. E.g. when a reviewer requests changes, they can review just the relevant commits after you push the changes, rather than the whole PR from scratch.
It's quite easy to get used to using git commit --amend and git rebase -i master, it just takes some practice.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In this specific case I don't see a downside of using
git commit --amend
(unless you've already pushed), so why not use it?Having an unclean commit history is not too harmful, all things considered, so you don't need to be perfect with it. However, a clean commit history provides some benefits:
git bisect
or find the commit manually.It's quite easy to get used to using
git commit --amend
andgit rebase -i master
, it just takes some practice.