|
|
|
|
|
by azinman2
4445 days ago
|
|
Thank you! I've always found this confusing and avoided it in my workflow. Assuming this explanation is correct, it makes a lot of sense and gives me a better workflow! Are there any other useful ways to use git for a small team outside of pull and rebase? One thing that's bugged me is undoing (possibly partially) previous pushed commits while keeping everything past. |
|
You can also use the same command to squash multiple commits into one. This is useful when you write a commit, then have several commits gradually adding temporary debugging statements and unit tests, then more commits to fix any problems uncovered, then more commits to remove extensive print statements and other temporary debugging code.
Assuming you get the code working, most of these commits will be totally irrelevant to future development efforts. With the "squash" feature of git rebase -i, you can condense all these commits into a single commit containing only working code and unit tests, springing fully formed in a single commit, like Athena from the head of Zeus.
The git rebase -i command will also let you re-word or edit commits; the utility of those functions should be obvious.