Git

  1. Background
    1. Git is the most popular distributed version control system (VCS)
    2. Originally created by Linus Torvalds, creator of Linux, in 2005
    3. git is British English slang that means "unpleasant person"
    4. GitHub (owned by Microsoft) hosts public and private repositories, accessible using git
    5. Online resources for learning git
      1. Interactive tutorial that takes 15 minutes
      2. Learning Version Control with Git online book
      3. git tutorials
  2. Create a repository on GitHub
    1. README.md text file containing Markdown that indicates who developed the software, how it should be used, etc.
    2. .gitignore file specifies what files should be ignored and not included in the repo (usually files that are created in the build process)
    3. A license indicates how the software can and cannot be used
  3. Basic workflow
    1. Clone the repo on GitHub (origin) onto your local machine
    2. Modify the local repo (add functionality, fix a bug, etc.)
    3. Commit your changes (save the current state of your repo) with a meaningful comment. Ex: Fix division-by-zero error, Add ability to save file
    4. Push changes to origin (copies all commits to GitHub repo)
  4. Alternate workflow
    1. Clone the repo on GitHub onto your local machine
    2. Create a branch in your repo
    3. Modify your branch (add functionality, fix a bug, etc.)
    4. Commit and push changes to your branch
    5. Create a pull request to ask collaborators for feedback on your changes
    6. Address review comments
    7. Merge your pull request into the main branch
    8. Delete your branch
  5. Using Git
    1. Advanced git users use the command line interface
      1. Requires memorizing numerous commands and arguments
      2. Helpful to keep a cheat sheet
    2. GUI clients are usually easier to use
      1. Many options available
      2. GitHub Desktop is free and ideal for working with GitHub
      3. SourceTree is free and very popular
      4. All clients allow use of command line interface as well
    3. Many IDEs have built-in git functionality
      1. Git experience in Visual Studio
      2. How to Use Git in Android Studio