Re:High-Level Problems with Git and How to Fix Them
by cryptonector on Tuesday December 12, 2017 @05:52PM
(#15910230)
The staging area is trivial to use effectively.
Just:
- edit files
- git add -e
- optionally git diff --staged (to review what will go in a commit)
- optionally lather, rinse, repeat as needed
- git commit
Alternatively:
- edit files
- git add
- git commit
- lather, rinse, repeat
- git rebase -i origin/master (or whatever) and reorder/squash/edit/split commits as needed
For the latter's last step, sometimes the easiest thing to do is to squash all commits when you're done, then git reset HEAD^, then apply the git add -e && git commit loop in order to break up your work into logical commits.
Just:
- edit files - git add -e - optionally git diff --staged (to review what will go in a commit) - optionally lather, rinse, repeat as needed - git commit
Alternatively:
- edit files - git add - git commit - lather, rinse, repeat - git rebase -i origin/master (or whatever) and reorder/squash/edit/split commits as needed
For the latter's last step, sometimes the easiest thing to do is to squash all commits when you're done, then git reset HEAD^, then apply the git add -e && git commit loop in order to break up your work into logical commits.
When done, push.