Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# Suppose you edited auth.js with two unrelated changes. # You want to commit them separately for a clean history. # Interactive patch mode — stage only some hunks: git add -p auth.js # Git shows each changed hunk and asks: # Stage this hunk? [y/n/q/a/d/s/?] # y — yes, stage this hunk # n — no, skip this hunk # s — split into smaller hunks # q — quit (don't stage remaining hunks) # ? — show help # Commit only the staged hunk: git commit -m "fix: handle expired JWT tokens" # Then stage and commit the second change: git add -p auth.js git commit -m "feat: add refresh token support" # View what is staged vs unstaged: git diff # unstaged changes git diff --staged # staged changes (ready to commit) # See staged files only (a quick summary): git status -s # M auth.js (M in green = staged, M in red = unstaged) # ?? new.js (?? = untracked)
Result
Open