Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An introduction to version control with git

Avatar for Connor Shea Connor Shea
September 06, 2017

An introduction to version control with git

A presentation made at Colorado State University's ACM club introducing students to version control using git.

Avatar for Connor Shea

Connor Shea

September 06, 2017
Tweet

More Decks by Connor Shea

Other Decks in Programming

Transcript

  1. Goals • Introduce the concepts of version control and Git

    • Show the basics of using Git • Demonstrate some basic use-cases
  2. What is Git? “I’m an egotistical bastard, and I name

    all my projects after myself. First Linux, now git.” - Linus Torvalds
  3. What is Git? • Originally created in April 2005 by

    Linus Torvalds for developing Linux • Free and open source distributed version control system • Designed to be fast, fully distributed, and simple
  4. What is “version control”? • Tracks changes to a project

    • Allows reverting to previous states • Makes collaboration easier • Keeps code backed up
  5. Centralized Version Control Systems • CVS (1990), SVN (2000) •

    Codebase stored on a central server • Clients must connect to the server to check out revisions • Single point of failure
  6. Decentralized Version Control Systems • Git (2005), Mercurial (2005) •

    No single central server • Each client gets a full copy of the repository, so everyone has their own “backup”
  7. Because I lied, it’s good. • Handles huge projects really

    well • Linux: 693,323 commits, 14,000 contributors • GitLab: 59,191 commits, 1,300 contributors • Python: 99,820 commits, 347 contributors • Rails: 64,581 commits, 3,374 contributors • Swift: 58,445 commits, 505 contributors • Windows: Probably pretty big
  8. Because I lied, it’s good. • Branches let contributors work

    on different features simultaneously. • Branches let contributors work on fixing bugs in older versions of software. • Repositories stay small, Linux’s repo is only 7GB. • Git is fast. Changing lots of files, deleting branches, making commits, etc. all take only a few seconds even for huge projects.
  9. Because I lied, it’s good. • You can look at

    the history of a codebase, and even revert back to an older version. • Most modern developer tooling is built around Git • SCMs like GitLab and GitHub. • Continuous Integration tools like GitLab CI, Jenkins, etc. • IDEs like Eclipse, IntelliJ, Visual Studio, etc. • Hosting platforms like DigitalOcean and Heroku.
  10. Because I lied, it’s good. • It’s very difficult to

    change the history of a repository. • Git commits are represented using SHA hashes, if you change a commit from last week, every commit after that will have a different SHA hash as well.
  11. Downsides • It can be very difficult, frustrating to learn.

    • Requires frequently looking at tutorials, help pages, etc. • Certain commands can cause you to possibly lose data. • It’s not great for binary files like images, videos, 3D models, etc.
  12. git help -g Lists various resources included in git that

    can be used to learn git. e.g. git help tutorial, git help workflow, etc.
  13. Command Line Interfaces can be scary • Eventually you’ll probably

    need to use Git from the command line. • When starting, a GUI can make using Git a lot more comfortable.
  14. Git GUIs GitHub Desktop + Free & Open Source -

    Only works with GitHub GitKraken + Supports Linux - Only Free for non-commercial uses SourceTree + Most “powerful” of the three - Free, but not open source
  15. GitLab + Free private projects with most features + Free

    & Open Source + Literally perfect with no downsides whatsoever GitHub + Most popular of the three + Free public projects - Closed source Bitbucket + Free for up to 5 people per project - Closed source
  16. Why learn to use Git? • Your eventual employer will

    almost definitely use it. • Great for group projects if everyone knows how to use it. • Keeps a backup of your project • You can go back to previous commits.