Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(commands): add cz commit arg to automatically stage every tracked and un-staged file #821

Merged

Conversation

Xiao75896453
Copy link
Contributor

Description

Adding cz commit arg to automatically stage every tracked and un-staged file

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

command cz commit -a will automatically stage every tracked and un-staged file .

Steps to Test This Pull Request

  1. cz commit -a

Additional context

#554

@codecov
Copy link

codecov bot commented Aug 20, 2023

@@ -92,6 +92,11 @@ def tag(tag: str, annotated: bool = False, signed: bool = False) -> cmd.Command:
return c


def add() -> cmd.Command:
c = cmd.run("git add .")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is what -a does. In this case even non-tracked files are being added. -a should happen on git commit -a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I misunderstood what git commit -a usage. I will modify this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, I think I misunderstood during the sprint as well 🫠 I belive you can check how the signoff feature is implemented. They are supposed to be similar

@woile
Copy link
Member

woile commented Aug 24, 2023

I wonder what's the advantage of doing git add -u vs doing git commit -a?
The plus side of git commit -a is that we call git once, does git add give some kind of different ergonomics?

@Xiao75896453
Copy link
Contributor Author

I do git add -u instead of git commit -a because of if git.is_staging_clean() and not dry_run.
If doing git commit -a, I think I may need to modify if git.is_staging_clean() and not dry_run and handle the simultaneous existence of git commit -s and git commit -a.
I feel it is more intuitive to use git add -u

@Lee-W
Copy link
Member

Lee-W commented Sep 4, 2023

I do git add -u instead of git commit -a because of if git.is_staging_clean() and not dry_run. If doing git commit -a, I think I may need to modify if git.is_staging_clean() and not dry_run and handle the simultaneous existence of git commit -s and git commit -a. I feel it is more intuitive to use git add -u

yep, agree with your point. @woile what do you think?

@woile
Copy link
Member

woile commented Sep 10, 2023

Sounds good

@Lee-W Lee-W force-pushed the feature/add_commit_arg_dash_a branch from e8b2a88 to a8bb1d1 Compare September 11, 2023 13:46
@Lee-W Lee-W merged commit ea91933 into commitizen-tools:master Sep 15, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants