c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.05k stars 134 forks source link

Git Ammend previous commit #196

Open alcantaraleo opened 3 years ago

alcantaraleo commented 3 years ago

Hi,

Thanks so much for making and supporting bump2version. I do have a query/request to propose though.

Currently, my workflow is working on the code modifications, git add and then git commit my changes. I then use bumpVersion without "Commit = True" to set the version and tag. This works fine. But the thing is that both the .cfg and the file which hosts the version are left modified (from Git's point of view) and I would have to commit them. But if I do go ahead and commit those files then my git history has as its HEAD the commit containing those two files instead of my changes.

If I turn on "Commit = true" it does the same thing. What I am asking is that if there is some different procedure I should take in order to avoid this? Or maybe a new feature which would allow to git ammend the previous commit instead of creating a new one when "Commit = True".

Any thoughts?

florisla commented 3 years ago

I don't think bump2version can be used in the way you describe.

I think most people consider it good practice to do the version bump in a separate commit.

Git allows you to squash multiple commits into one. But I'm not sure how that would affect the tag. A tag is supposed to be stable, i.e. once it's created it should not be modified.