1

So the scenario is, I committed some changes to local branch. After sometime I realized it should be amended, so did an amend. After some spec changes I am again in the need of an amend. So practically it will only be a single commit when I'll push it to remote or what? All I need is a cleaner history.

Shrikshel
  • 37
  • 1
  • 9

1 Answers1

3

Yes. And before pushing, you can do this unlimited times. As described on documentation:

[...] first make the changes you think you forgot, stage those changes, and the subsequent git commit --amend replaces that last commit with your new, improved commit.

Plus, you can also do a lot of local commits and use git squash (or just using soft reset) to create one single commit before pushing on repository:

It’s also possible to take a series of commits and squash them down into a single commit with the interactive rebasing tool.

[...] When you save that, you have a single commit that introduces the changes of all three previous commits.

Community
  • 1
  • 1
Dherik
  • 17,757
  • 11
  • 115
  • 164