Skip to content
Discussion options

You must be logged in to vote

Hey! @A-Akhil

One tip that really improved my workflow is using git add -p for selective staging.
Instead of committing an entire file, you can interactively choose which hunks to stage:

git add -p
Git will show each change and let you choose:

1. y to stage it
2. n to skip it
3. e to edit the hunk
4. s to split it

It’s great for keeping commits clean and focused.
Another helpful workflow improvement is:

git switch -c <branch-name>

This creates and switches to a new branch in a single command, making it clearer and less error-prone than using checkout.
Both of these have helped me maintain a cleaner commit history and avoid mixing unrelated changes.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant