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

Intro to Git

Avatar for andylind andylind
October 31, 2012

Intro to Git

This is an intro level presentation on Git. In this presentation, I give some background on Git, discuss key concepts behind Git, and introduce some Git commands.

Avatar for andylind

andylind

October 31, 2012
Tweet

More Decks by andylind

Other Decks in Programming

Transcript

  1. • Some History • About Git • Git commands •

    Using git with svn • Dev workflows Agenda
  2. Eclipse Users Survey 2009: 2010: 2011: 2012: svn 57.5% 58.3%

    51.3% 46.0% git 2.4% 6.8% 12.8% 27.6%
  3. • Frictionless Context Switching • Role-Based Code lines • Feature

    Based Workflow • Disposable Experimentation
  4. Basic Commands #create an empty repository in cwd git init

    #add contents to the next commit git add #show the working tree status git status #record changes to the repository git commit #show commit log git log
  5. A Simple Example #new git repo git init #add a

    file touch my-file.txt #add changes to staging area git add my-file.txt #commit staged changes git commit -m "made some changes"
  6. Sharing Changes #get new changes from external repository git fetch

    #fetch + merge git pull # write new changes to external repository git push
  7. Branching #create/modify/delete branches git branch #switch working dir to another

    branch/commit git checkout #merge two or more branches git merge #changes starting point of a branch git rebase #set a branch back to HEAD git reset
  8. Git Bisect #binary search commit history for a commit #e.g.

    a commit introducing a bug git bisect start git bisect good ae4f902 git bisect bad c5f9814
  9. Setup Git with svn #create local git svn repo git

    svn init -s http://url-of-repo git svn fetch git svn rebase
  10. Git svn Workflow #work on a local branch or branches

    git checkout -b myfeature #make some changes and commit git commit -a -m "made some changes" #switch to master and rebase changes git checkout master git rebase myfeature git svn rebase #commit changes to svn git svn dcommit