Learning to use git effectively
Last year I gave this presentation to try to motivate researchers and analysts at my workplace to learn how to use version control. I learned to use git just a few years ago, and so I remember how daunting it is at first. I generally operate under the assmumption that git is hard to learn, so in my presentation I focus on trying to motivate listeners , and disprove some of the common excuses for not using git.
Effectively using git is an ongoing process though, and the web has a wealth of resources for the motivated learner. Here's a collection of tutorials, courses and posts that I reference when I need a refresher on terms, or a reminder of what best pratcies are.
Presentation
Tutorials
- So far this was the most-helpful tutorial I've ever taken. It explains terminology, is heavily visual, and gives you practice.
- Another good intro/setup post & practice the basic commands
Terminology & Background
- Common commands
- Visual guide to version control
- Aha-moments when learning git
- Command line primer
Best Practices
- Master is the place to put everything that works
- Branches make it easy to prototype out changes that may or may not work. Create and destroy branches with ease.
- Commit atomically and follow good-practices. Commit things that work together to produce a single unit of work
- Commit often and don't go dark
- Commit messages describe why a change is made, should Be useful, and are signs of a good collaborator
- Keep a clean git history
Workflows & Guidelines
- 8 simple steps to a team of happy git-users
- Some advice on small-team workflows and centralized workflows
- Pull requests are good communication
Extra tips
- I primarily use the command line, but my favorite gui, Sourcetree has a nice & intuitive interface for viewing logs, adding patches and comparing branches.
- Doing work on a branch gives you maximium flexibility when you're trying something out.
- Rebasing can be useful for cleaning-up lots of commits on a branch before merging. You can easily combine commits, and re-write messages.