Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request updates the Git pre-commit hook command. The hook now uses Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Hook as Pre-commit Hook
participant Git as Git
Dev->>Hook: Initiate commit
Hook->>Git: Execute "git add -u"
Git-->>Hook: Stage modifications and deletions (tracked files only)
Hook->>Dev: Continue with commit process
Possibly related PRs
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📥 CommitsReviewing files that changed from the base of the PR and between d7e3d02a74bfae3ebe7893b21b70c959e063beeb and bde64fb. 📒 Files selected for processing (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
"git add ." adds *ALL* changes in the working directory into the commit, whether they had been staged or not. This means the commit would end up with files the user may not have intended to be there. Instead, only files that were already staged should be added, which the -u flag provides. Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
d7e3d02 to
bde64fb
Compare
We have git add . in our git pre-commit hook but this has a big problem: it adds ALL changes in the working directory into the commit, whether they had been staged or not. This means that when someone has multiple changed / new files in the working directory, the commits end up with all those files in the commit, even if the user only intended for a couple of them to be there.
Instead, only files that were already staged, meaning explicitly added by the user, should be added by the hook. Git add has the -u flag for that.
Summary by CodeRabbit
Summary by CodeRabbit