Git Back Control of Your Code

Learning How to Manage Your Code with Git & GitHub




Press [Space] To Progress

Who am I?

Brett Chalupa

What is Version Control?

define: version control

The task of keeping a software system consisting of many versions and configurations well organized.

Why use Version Control?

  • Confidence
  • Collaboration
  • Process

What is Git?

define: git

An extremely fast, efficient, distributed version control system ideal for the collaborative development of software.

Why use Git?

  • Distributed
  • Community
  • Tools

The Git Workflow

  1. Initialize a Repo
  2. Make changes to the codebase
  3. Stage the modified files to be committed
  4. Commit the changes
  5. Push the changes

The Git Workflow

Creating a New Repository

  1. git init
  2. git status
  3. git add changed_file.rb
  4. git commit -m "change some files"
  5. git push github master

The Git Workflow

Making Changes to an Existing Repository

  1. git pull origin master
  2. git status
  3. git add changed_file.rb
  4. git commit -m "change some files"
  5. git push github master

The Git Workflow

Branching and Merging

  1. git checkout -b bc/new_branch
  2. git status
  3. git add changed_file.rb
  4. git commit -m "change some files"
  5. git push github bc/new_branch

Other Useful Git Commands

            
              git diff # show the differences
              git branch -a # show all branches, locally and remotely
               
              git remote # list remotes
              git remote -v # list remotes with detail
              
              git reset --hard HEAD~1 # go back 1 commit before the head
              git remote rename origin github # rename a remote

              git stash # temporarily store your changes
              git stash pop # pop stashed changes back on top
              git stash drop # drop stashed changes
            
          

What is GitHub?

define: github

Online project hosting using Git.

Octocat

Why use GitHub?

  • Pull Request
  • Gists
  • In-line Comments
  • Wikis
  • Repository Forking
  • Issue & Bug Tracking
  • Octocats

Try Git

http://try.github.com/

Additional Resources

Thank you!

http://bit.ly/gristmill-git-presentation

http://gristmill.io

http://brettchalupa.com