4 ms·
Learn how to use git's partial commit functionality `git add -p`, `git checkout -p`, `git reset -p`, etc. Also get comfortable with rebasing. The most foolproo
by war1025 6y ago
Learn how to use git's partial commit functionality `git add -p`, `git checkout -p`, `git reset -p`, etc.
Also get comfortable with rebasing. The most foolproof formula I've found is
git rebase -i <commit hash immediately before what you want to move> [--onto <branch you want to be the new base>]
Using the two of those together, you can clarify your commits and have code that is actually reviewable rather than stream of consciousness spaghetti commits.
Makes reviews more pleasant and looking back through history more useful.
Also learn to use `git log -p` to look through the change history of files. Immensely more useful than `git blame`.
- djeikyb 6y agoi personally love partial staging/commits but haaate ’git add -p’. i use tig and a few other partial staging user interfaces. learning how to stage part of a line, in a favourite code tool, is a skill i appreciate for myself
- prashnts 6y agoI'd really like to know how you use tig for that. I am overwhelmed with the options and keystrokes that I can't remember.