427 Git Commands B6a53e87

Git Commands for Commit Workflows

tools-only Updated 7 repo stars

File contents

Git Commands for Commit Workflows

Useful git commands when analysing, staging, and amending commits.

Analysing changes

Review what is being committed:

# Show files changed
git status

# Show detailed changes
git diff --staged

# Show statistics
git diff --staged --stat

# Show changes for specific file
git diff --staged path/to/file

Interactive staging

Use git add -p for selective staging:

# Stage changes interactively
git add -p

# Review what's staged
git diff --staged

# Commit with message
git commit -m "type(scope): description"

Amending commits

Fix the last commit message:

# Amend commit message only
git commit --amend

# Amend and add more changes
git add forgotten-file.js
git commit --amend --no-edit

tools-only/X-Skills/tree/main/automation/workflow/427-git-commands_b6a53e87 commit 02fa6d5083

Frequently asked questions

npx skillmds@latest add tools-only/427-git-commands-b6a53e87