ENGR 100 Git Tips

This is a set of tips to make using Git as easy and painless as possible. You are most than welcome to use advanced features of Git, but if you are looking to get away with the bare minimum then you may find this helpful.

The Golden Rule

Never delete history. This is the easiest way to accidentally delete part or all of your work. We have disabled this feature on GitHub to try to prevent the issue, but we'd rather you not try to remove history as this frequently results in bad things. Removing history includes:

If you are trying to correct an accidental commit, instead use git revert. This will create a new commit that reverts your changes to a previous commit without running the risk of deleting history. For example, if you wish to create a new commit that is identical to 1 commit before the current commit, use git revert HEAD~1

Tips