Introduction to Version Control
What is Version Control?
- A tool that tracks changes to files
- Records the changes you made, and the order in which you made
them
- Like the history of a page on Wikipedia
- Or - like turning on ‘Track Changes’ in Word, but for code.
Why use Version Control?
A more efficient backup
- Avoid multiple versions of same file
Why use Version Control?
Reproducibility
- Access to a copy of every version of the code
- Easy to replicate results from any paper!
- Easy to share full copy of any version
Why use Version Control?
To aid collaboration
- Easy to build on others’ changes
- Share one version with collaborators whilst you work on another
Version Control Systems
- Git - overwhelmingly the most popular
- Mercurial
- Subversion
How can you use Version Control?
- Command-line
git
- Standalone graphical user interface
- GitHub Desktop
- Git Kraken
- Sourcetree
- Built into most IDEs
- Visual Studio Code
- RStudio
- PyCharm
Lesson Outline
We’ll cover how to use git to:
- Create a ‘repository’ and use it to track changes to files
- Review how your code has changed over time
- Recover old versions of files
- Back up your files to GitHub (or another remote repository!)
- Collaborate remotely and resolve conflicting edits to files