c4urself / bump2version

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

Allow certain files to be dirty #259

Open awbacker opened 1 year ago

awbacker commented 1 year ago

I am looking for a way to allow certain files to be included with the bump command, so they can be part of the versioned commit. I'm thinking of version specific generated artifacts right now, but there are probably other uses cases.

Would something like this be helpful to others?

Current process

The goal is to get a single commit with all files, with the correct subject. That subject is used to trigger steps in the build.

  1. bump version
  2. python gen-summary.py > docs/summary.md
  3. git add docs/summary.md
  4. git commit --amend --no-edit
  5. push

It would be nice to be able to specify directories or specific files that should be included in the commit if they are dirty (or possibly ignored)?

Include these files IF they are dirty, all others are errors

$> bump2version patch \
       --include-if-dirty=docs/*.md \
       --include-if-dirty=docs/favicon.ico

Allow specific dirty files

Allow some files to be dirty if they are ADDed in git. If the modified files are not staged yet, then an error could still be thrown

$> git add docs/summary.md
$> bump2version patch --allow-modified = docs/*.md