General
PromptBeginner5 minmarkdown
2. Apply Deepthink Protocol (reason about dependencies
risks
16
This rules needs to apply when commiting to git.
Sign in to like and favorite skills
Before creating commits, always review your current changes:
# Check which files have been modified git status # See detailed changes in all modified files git diff # See changes in specific files git diff <filename> # See staged vs unstaged changes git diff --cached # Shows staged changes git diff HEAD # Shows all changes (staged + unstaged)
Instead of
git add ., stage files selectively:
# Stage specific files git add <file1> <file2> # Stage parts of files interactively git add -p <filename> # Stage all files of a certain type git add *.py git add *.md # Review what's staged git diff --cached
# 1. Check what changed git status git diff # 2. If you have mixed changes, create separate commits: # Commit 1: Fix a specific bug git add src/bug-file.py tests/test-bug-fix.py git commit -m "fix(api): resolve timeout issue in user endpoint" # Commit 2: Add new feature git add src/feature-file.py src/feature-helper.py git commit -m "feat(auth): add two-factor authentication" # Commit 3: Update documentation git add README.md docs/api.md git commit -m "docs: update authentication setup guide" # Commit 4: Refactor existing code git add src/utils.py git commit -m "refactor(utils): simplify date formatting functions"
Always follow the Conventional Commits specification for all commit messages.
<type>[scope]: <description> [optional body] [optional footer(s)]
Use only one of these scopes. Do not invent other scopes (e.g. no
adaptive-testing, api, auth).
feat(backend): add login validation)BREAKING CHANGE: in footer for breaking changesfeat(backend): add user authenticationfix(frontend): resolve timeout issue in user endpointdocs: update installation guiderefactor(backend): simplify date formatting functionfeat!: remove deprecated API endpoints (! indicates breaking change)# If you have too many changes in one file, split them: git add -p <filename> # Interactively stage hunks # Reset specific files from staging git reset <filename> # Reset specific hunks git reset -p <filename>
# Add more changes to the last commit git add <forgotten-file> git commit --amend # Change the last commit message git commit --amend -m "new commit message" # Interactive rebase to reorganize recent commits git rebase -i HEAD~3 # Edit last 3 commits
git status to see what's changedgit diff to review the actual changesWhen creating commits, always format them according to this specification and follow the logical grouping workflow.