Mastering better collaboration
Up until now, we have discussed how to handle merges and resolve conflicts in Git. We have seen that you can clean up your local changes with git merge --squash
or adjust commit history with git rebase
. While it is great to keep your workspace neat, the ideal scenario is to maintain a clean code base, especially when you push to a shared environment. Next, let’s talk about the commands that enable you to be an excellent collaborator, whether you are an individual contributor or a team leader managing the main shared branch.
Rolling back time
In any collaborative project, mistakes are inevitable. Even if it was not a mistake, there will be many times you will want to rewind and go back in time. Whether it is a bad commit that breaks the build or a feature that did not pan out as expected, the ability to roll back changes is crucial. Two commands that are indispensable for this are git reset
and git revert
.