SlideShare ist ein Scribd-Unternehmen logo
1 von 81
SOURCE CONTROL
  MANAGEMENT
    With Git
BUT WAIT!
TEXT EDITOR AND SHELL



Some Editors                      The Shell
  Sublime Text 2                      Git Bash
   Komodo Edit                        Terminal
    Coda (Mac)                          ssh
Text Wrangler (Mac)
   PSPad (Win)
  TextEdit (Win)
IMPORTANT PRE-CLASS LINKS




http://   bit.ly/gdiscm
MARKDOWN QUICK GUIDE


# Level 1 Header (h1)                       This is *italic*. (em)
## Level 2 Header (h2)                      This is **bold**. (strong)
##### Level 5 Header (h5)
                                            This links to
Line breaks must have                       [Google](http://google.com)
two spaces at the end of the line.
                                            * First Item
Paragraphs are separated by a blank line.   * Second Item
                                            * Third Item
      Indent code blocks
      with four spaces!
TRADITIONAL INTRO
    begins here…
ABOUT ME



Owen Winkler
Twitter: @ringmaster
Email: ringmaster@midnightcircus.com
GitHub: https://github.com/ringmaster
TODAY’S PLAN



           1. Basics of SCM
          2. Starting a Project
3. Branching and Experimentation
       4. GitHub and Remotes
        5. Conflict Resolution
   6. (Maybe) Using Submodules
WHAT IS SCM?
aka “Revision Control”
THE CURRENT STATE OF THINGS
WHAT IS SCM?



      Revision control, also known as version
 control and source control is the management of
changes to documents, computer programs, large web
     sites, and other collections of information.
                               ~ Wikipedia
ADVANTAGES OF SCM



   • Resilience
• Collaboration
   • Efficiency
• Accountability
  • Integration
VOCABULARY


Working Copy                 Remote
 Production                 Pull/Push
 Repository                   Merge
    Stage                    Conflict
  Commit                     Resolve
   Revert                     Hash
    Head
   Branch
   Master
     Tag
THE GIT PROCESS
THE GIT PROCESS
THE GIT PROCESS
THE GIT PROCESS
THE GIT PROCESS
SHELL BASICS
The Bare Minimum
COMMANDS YOU SHOULD KNOW


ls              List the contents of a directory
ls -la          List ALL the contents of a directory (hidden files, times, sizes)
cd xx           Change to the directory “xx”
cd ..           Change to the directory above this one
cd ~            Change to your home directory
cd /            Change to the directory at the root of your computer
mkdir           Make a directory
pwd -P          Show the full path of the current directory
[letter][tab]   Autocomplete or show all possibilities
[up-arrow]      Use the last command in your history
OTHER USEFUL COMMANDS


[Ctrl]+R           Search for a previously used command
history            List the last 100 or so commands you used
alias l="ls -la"   Assign the command “l” to do “ls -la”
mv xx yy           Rename/move the file “xx” as “yy”
rm xx              Delete the file named “xx”
rmdir xx           Delete the empty directory named “xx”
LET’S MAKE A FILE



Step 1                                  Step 2
•   Change to the user directory        • Find the directory you created in
•   Make a directory for this class       Finder/Explorer
•   Change to the class directory       • Create a file called
                                          “contributors.txt”
•   Create a directory called “names”
                                        • Edit that file in your editor
•   Change to that directory
                                        • Add your name to the file


                    Do not create the directory
                   using Finder/Explorer/your
                              editor!
HERE COMES THE FUN PART
       Starting with git
CENTRALIZED
VERSION CONTROL




     Some
    Central
    Server




     My
   Computer
DISTRIBUTED
VERSION CONTROL




   My
 Computer
CREATE A REPO


Configure Git Global Settings
• Set your git username
        git config --global user.name "github-user-name"
• Set your git email address
        git config --global user.email "github-email“
• Set your git editor
        Mac: git config --global core.editor "nano"
        Windows: Use GitPad


Procedure
• Change to the working directory
• Initialize the repo
         git init
GIT STATUS



Files can have (in general) 4 states:
           • Untracked
             • Tracked
            • Changed
              • Staged
GIT ADD/STAGE


                We need a way to stage things to be committed.
                  Committing is an “all at once” action.


Procedure
• Add the contributors.txt file to stage it.
      git add contributors.txt
• Check the status of the working directory.
      git status
COMMIT


                       Commit changes to the repo.
               All staged changes are committed at once.
            Every commit is stored in the repo with a “hash”.

Procedure
• Commit all staged changes
        git commit
LET’S MAKE A CHANGE



Procedure
• Get neighbor’s name and why they’re here
• Add neighbor’s name to your editor (It’s still open, right?)
• Save the file with the added name
• Check the status of your working directory
      git status
• Add the file to be staged
      git add contributors.txt
• commit the changes to your repo
      git commit
INTERLUDE
Isn’t this exciting?
GIT STASH


                     Stash is the coolest feature ever.
           Stash allows you to make other changes mid-change.

Procedure
• While you still have changes… DO NOT COMMIT!
• Instead, stash your changes
        git stash
• Then make your change, add, and commit as normal
      git add; git commit
• Then pop your change off the stash
      git stash pop
INTERLUDE
Isn’t this exciting?
GIT DIFF


                     For when you ask yourself,

          Hey, wait a minute, what did I change? ?

Procedure
• Use Diff to see what is currently changed, but not yet staged
       git diff
• Use Diff to see what is staged, but not yet committed
       git diff –cached
• Use Diff to see the differences between your working copy
  and the last commit
       git diff HEAD
GIT LOG


    Use the log to see what you and others have been adding to your repo.


Procedure
• Use git log to see all changes in your current branch
       git log
• Use --oneline to see each change in the log on one line
       git log –oneline
• Use the hashes shown in the log to get the diff between two commits
       git diff
INTERLUDE
Isn’t this exciting?
GIT REBASE


                 This is the “What the heck?” git command.
 Rebase allows you to combine a bunch of commits into one that makes you
                 look less like a freakish commit-crazy idiot.


Procedure
• Use rebase to interactively select from the last 5 small commits
  to combine into one big commit
       git rebase –I HEAD~5
INTERLUDE
Isn’t this exciting?
BRANCHING


                  Branching allows you to get experimental.
  You can leave the state of master alone, and work solely on your branch.

Process
• Create a new branch
       git branch markdownlist
• Checkout the branch you want to work on
       git checkout markdownlist
• OR Create a new branch and switch to using it all in one step
       git checkout -b markdownlist
• Then list the branches that are available
       git branch
       git branch -v
ADD THAT LIST
 Asterisks aplenty
SWITCHING BETWEEN
                               BRANCHES


                   Branches track their own change history.
                     Switching between branches changes
             only the unmodified, tracked files in your working copy.


Procedure
• Check with branch you are on
      git status
• Checkout the master branch
      git checkout master
• Verify that you’re on the master branch
        git status
REINTEGRATING BRANCHES


  If the changes in a branch need to be copied into the master branch, they
                              should be merged.
                       Merging is usually a scary word.


Procedure
• Checkout the branch that the new code should be moved to
      git checkout master
• Merge the branch into the current branch
      git merge markdownlist
FEATURE BRANCHES


Development teams use Feature Branches for different purposes.
TAGGING


  Tagging marks a specific commit with a name, and optionally annotates it.


Procedure
• Use git tag to create a lightweight tag of the current branch at HEAD
       git tag version1
• OR, Use the -a flag to annotate the tag
       git tag -a version 1 -m "My message"

• Use git show to see the commit of the tag
       git show version1
GITHUB
A central git website
SSH KEYPAIRS


 SSH is the method Github uses to securely exchange data.
 Public Keys are the means that Github uses to authenticate.
We must create a key pair to authenticate ourselves to Github.
CREATE A REPO
   On Github!
INITIALIZE A REPO FROM
                         SCRATCH ON GITHUB


             Using the instructions to get a repo from Github.

Procedure
• Create the repo on Github
• Follow the instructions to create an empty repo
        git init; git add; git commit
• Connect the repo to Github
      git remote add origin
                git@github.com:ringmaster/scm.git
• Push the repo to Github
       git push –u origin master
GIT PUSH


          After you’ve completed a commit that you want to share,
                push your commits to the remote repository.

Procedure
• Finalize any commits (modified or untracked files won’t be pushed!)
• Execute git push on your repo
        git push origin master
GIT PULL


  When you want to update your working copy from the remote repository,
                              use git pull.

Procedure
• Commit or stash any changes (git won’t let you pull over modified files!)
• Execute git pull on your repo
        git pull origin master
ADDING A NEW REMOTE


Let’s try creating a new repo on Github for our contributors.txt file repo, and
                          then pushing to that remote.


Procedure
• Create a new repo on Github
• Add the repo URL (ssh) as a remote on the existing working copy
       git remote add origin
                git@github.com:ringmaster/contrib.git
• Push the repo to Github
       git push –u origin master
CLONING EXISTING REPOS
     This is the fun part
CLONING


 When there is an existing repo on Github that you would like to work on as
                        your working copy, you clone it.


Procedure
• Copy the git URL from the Github page (use the ssh version)
• Execute git clone where you want to create your new working copy
      git clone git@github.com:ringmaster/fob.git
CONFLICT RESOLUTION
   No, this is the fun part
HERE WE GO…



https://github.com/ringmaster/gdiscm
OWEN’S IMMUTABLE
                            LAWS OF SCM


• If you run blame, you’re most likely to find that you’re the one at fault.
  • Commit whenever you feel like you’ve reached a point that you’re
   complete, even (especially) if you might immediately rewrite the whole
                                    thing.
RESOURCES


http://git-scm.com/about

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...SlideTeam
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHubNicolás Tourné
 
GIT presentation
GIT presentationGIT presentation
GIT presentationNaim Latifi
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015mwrather
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Simplilearn
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamentalRajesh Kumar
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthroughBimal Jain
 
Git Introduction
Git IntroductionGit Introduction
Git IntroductionGareth Hall
 
Git Terminologies
Git TerminologiesGit Terminologies
Git TerminologiesYash
 

Was ist angesagt? (20)

Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 
Git 101
Git 101Git 101
Git 101
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
git and github
git and githubgit and github
git and github
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git training
Git trainingGit training
Git training
 
Git
GitGit
Git
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamental
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
 

Andere mochten auch

Social media in 12minuten
Social media in 12minutenSocial media in 12minuten
Social media in 12minutenPeter Ros
 
Web 3.0 voor fontys hogeschool
Web 3.0 voor fontys hogeschoolWeb 3.0 voor fontys hogeschool
Web 3.0 voor fontys hogeschoolPeter Ros
 
Qs Talk seminar klinish onderzoek
Qs Talk seminar klinish onderzoekQs Talk seminar klinish onderzoek
Qs Talk seminar klinish onderzoekPeter Ros
 
WordCamp Philly 2011 - put your business on the web
WordCamp Philly 2011 - put your business on the webWordCamp Philly 2011 - put your business on the web
WordCamp Philly 2011 - put your business on the webOwen Winkler
 
Seo trends 2013
Seo trends 2013Seo trends 2013
Seo trends 2013Peter Ros
 
Drupal security best practices
Drupal security best practicesDrupal security best practices
Drupal security best practicesOwen Winkler
 
Deployment And Change Management
Deployment And Change ManagementDeployment And Change Management
Deployment And Change ManagementOwen Winkler
 

Andere mochten auch (7)

Social media in 12minuten
Social media in 12minutenSocial media in 12minuten
Social media in 12minuten
 
Web 3.0 voor fontys hogeschool
Web 3.0 voor fontys hogeschoolWeb 3.0 voor fontys hogeschool
Web 3.0 voor fontys hogeschool
 
Qs Talk seminar klinish onderzoek
Qs Talk seminar klinish onderzoekQs Talk seminar klinish onderzoek
Qs Talk seminar klinish onderzoek
 
WordCamp Philly 2011 - put your business on the web
WordCamp Philly 2011 - put your business on the webWordCamp Philly 2011 - put your business on the web
WordCamp Philly 2011 - put your business on the web
 
Seo trends 2013
Seo trends 2013Seo trends 2013
Seo trends 2013
 
Drupal security best practices
Drupal security best practicesDrupal security best practices
Drupal security best practices
 
Deployment And Change Management
Deployment And Change ManagementDeployment And Change Management
Deployment And Change Management
 

Ähnlich wie Source control management

Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideRaghavendraVattikuti1
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptxtnscharishma
 
Fall18 Git presentation
Fall18 Git presentationFall18 Git presentation
Fall18 Git presentationJustinTirrell1
 

Ähnlich wie Source control management (20)

Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Git basic
Git basicGit basic
Git basic
 
Git 101
Git 101Git 101
Git 101
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
Fall18 Git presentation
Fall18 Git presentationFall18 Git presentation
Fall18 Git presentation
 
Git hub
Git hubGit hub
Git hub
 
Session git
Session gitSession git
Session git
 

Source control management

  • 1. SOURCE CONTROL MANAGEMENT With Git
  • 3. TEXT EDITOR AND SHELL Some Editors The Shell Sublime Text 2 Git Bash Komodo Edit Terminal Coda (Mac) ssh Text Wrangler (Mac) PSPad (Win) TextEdit (Win)
  • 5. MARKDOWN QUICK GUIDE # Level 1 Header (h1) This is *italic*. (em) ## Level 2 Header (h2) This is **bold**. (strong) ##### Level 5 Header (h5) This links to Line breaks must have [Google](http://google.com) two spaces at the end of the line. * First Item Paragraphs are separated by a blank line. * Second Item * Third Item Indent code blocks with four spaces!
  • 6. TRADITIONAL INTRO begins here…
  • 7. ABOUT ME Owen Winkler Twitter: @ringmaster Email: ringmaster@midnightcircus.com GitHub: https://github.com/ringmaster
  • 8. TODAY’S PLAN 1. Basics of SCM 2. Starting a Project 3. Branching and Experimentation 4. GitHub and Remotes 5. Conflict Resolution 6. (Maybe) Using Submodules
  • 9. WHAT IS SCM? aka “Revision Control”
  • 10. THE CURRENT STATE OF THINGS
  • 11. WHAT IS SCM? Revision control, also known as version control and source control is the management of changes to documents, computer programs, large web sites, and other collections of information. ~ Wikipedia
  • 12. ADVANTAGES OF SCM • Resilience • Collaboration • Efficiency • Accountability • Integration
  • 13. VOCABULARY Working Copy Remote Production Pull/Push Repository Merge Stage Conflict Commit Resolve Revert Hash Head Branch Master Tag
  • 20. COMMANDS YOU SHOULD KNOW ls List the contents of a directory ls -la List ALL the contents of a directory (hidden files, times, sizes) cd xx Change to the directory “xx” cd .. Change to the directory above this one cd ~ Change to your home directory cd / Change to the directory at the root of your computer mkdir Make a directory pwd -P Show the full path of the current directory [letter][tab] Autocomplete or show all possibilities [up-arrow] Use the last command in your history
  • 21. OTHER USEFUL COMMANDS [Ctrl]+R Search for a previously used command history List the last 100 or so commands you used alias l="ls -la" Assign the command “l” to do “ls -la” mv xx yy Rename/move the file “xx” as “yy” rm xx Delete the file named “xx” rmdir xx Delete the empty directory named “xx”
  • 22. LET’S MAKE A FILE Step 1 Step 2 • Change to the user directory • Find the directory you created in • Make a directory for this class Finder/Explorer • Change to the class directory • Create a file called “contributors.txt” • Create a directory called “names” • Edit that file in your editor • Change to that directory • Add your name to the file Do not create the directory using Finder/Explorer/your editor!
  • 23. HERE COMES THE FUN PART Starting with git
  • 24. CENTRALIZED VERSION CONTROL Some Central Server My Computer
  • 26. CREATE A REPO Configure Git Global Settings • Set your git username git config --global user.name "github-user-name" • Set your git email address git config --global user.email "github-email“ • Set your git editor Mac: git config --global core.editor "nano" Windows: Use GitPad Procedure • Change to the working directory • Initialize the repo git init
  • 27.
  • 28. GIT STATUS Files can have (in general) 4 states: • Untracked • Tracked • Changed • Staged
  • 29.
  • 30. GIT ADD/STAGE We need a way to stage things to be committed. Committing is an “all at once” action. Procedure • Add the contributors.txt file to stage it. git add contributors.txt • Check the status of the working directory. git status
  • 31.
  • 32. COMMIT Commit changes to the repo. All staged changes are committed at once. Every commit is stored in the repo with a “hash”. Procedure • Commit all staged changes git commit
  • 33.
  • 34. LET’S MAKE A CHANGE Procedure • Get neighbor’s name and why they’re here • Add neighbor’s name to your editor (It’s still open, right?) • Save the file with the added name • Check the status of your working directory git status • Add the file to be staged git add contributors.txt • commit the changes to your repo git commit
  • 36. GIT STASH Stash is the coolest feature ever. Stash allows you to make other changes mid-change. Procedure • While you still have changes… DO NOT COMMIT! • Instead, stash your changes git stash • Then make your change, add, and commit as normal git add; git commit • Then pop your change off the stash git stash pop
  • 38. GIT DIFF For when you ask yourself, Hey, wait a minute, what did I change? ? Procedure • Use Diff to see what is currently changed, but not yet staged git diff • Use Diff to see what is staged, but not yet committed git diff –cached • Use Diff to see the differences between your working copy and the last commit git diff HEAD
  • 39.
  • 40.
  • 41. GIT LOG Use the log to see what you and others have been adding to your repo. Procedure • Use git log to see all changes in your current branch git log • Use --oneline to see each change in the log on one line git log –oneline • Use the hashes shown in the log to get the diff between two commits git diff
  • 42.
  • 44. GIT REBASE This is the “What the heck?” git command. Rebase allows you to combine a bunch of commits into one that makes you look less like a freakish commit-crazy idiot. Procedure • Use rebase to interactively select from the last 5 small commits to combine into one big commit git rebase –I HEAD~5
  • 45.
  • 47. BRANCHING Branching allows you to get experimental. You can leave the state of master alone, and work solely on your branch. Process • Create a new branch git branch markdownlist • Checkout the branch you want to work on git checkout markdownlist • OR Create a new branch and switch to using it all in one step git checkout -b markdownlist • Then list the branches that are available git branch git branch -v
  • 48.
  • 49.
  • 50. ADD THAT LIST Asterisks aplenty
  • 51. SWITCHING BETWEEN BRANCHES Branches track their own change history. Switching between branches changes only the unmodified, tracked files in your working copy. Procedure • Check with branch you are on git status • Checkout the master branch git checkout master • Verify that you’re on the master branch git status
  • 52.
  • 53. REINTEGRATING BRANCHES If the changes in a branch need to be copied into the master branch, they should be merged. Merging is usually a scary word. Procedure • Checkout the branch that the new code should be moved to git checkout master • Merge the branch into the current branch git merge markdownlist
  • 54.
  • 55. FEATURE BRANCHES Development teams use Feature Branches for different purposes.
  • 56.
  • 57. TAGGING Tagging marks a specific commit with a name, and optionally annotates it. Procedure • Use git tag to create a lightweight tag of the current branch at HEAD git tag version1 • OR, Use the -a flag to annotate the tag git tag -a version 1 -m "My message" • Use git show to see the commit of the tag git show version1
  • 58.
  • 60. SSH KEYPAIRS SSH is the method Github uses to securely exchange data. Public Keys are the means that Github uses to authenticate. We must create a key pair to authenticate ourselves to Github.
  • 61.
  • 62.
  • 63.
  • 64. CREATE A REPO On Github!
  • 65. INITIALIZE A REPO FROM SCRATCH ON GITHUB Using the instructions to get a repo from Github. Procedure • Create the repo on Github • Follow the instructions to create an empty repo git init; git add; git commit • Connect the repo to Github git remote add origin git@github.com:ringmaster/scm.git • Push the repo to Github git push –u origin master
  • 66.
  • 67.
  • 68.
  • 69. GIT PUSH After you’ve completed a commit that you want to share, push your commits to the remote repository. Procedure • Finalize any commits (modified or untracked files won’t be pushed!) • Execute git push on your repo git push origin master
  • 70.
  • 71. GIT PULL When you want to update your working copy from the remote repository, use git pull. Procedure • Commit or stash any changes (git won’t let you pull over modified files!) • Execute git pull on your repo git pull origin master
  • 72.
  • 73. ADDING A NEW REMOTE Let’s try creating a new repo on Github for our contributors.txt file repo, and then pushing to that remote. Procedure • Create a new repo on Github • Add the repo URL (ssh) as a remote on the existing working copy git remote add origin git@github.com:ringmaster/contrib.git • Push the repo to Github git push –u origin master
  • 74.
  • 75. CLONING EXISTING REPOS This is the fun part
  • 76. CLONING When there is an existing repo on Github that you would like to work on as your working copy, you clone it. Procedure • Copy the git URL from the Github page (use the ssh version) • Execute git clone where you want to create your new working copy git clone git@github.com:ringmaster/fob.git
  • 77.
  • 78. CONFLICT RESOLUTION No, this is the fun part
  • 80. OWEN’S IMMUTABLE LAWS OF SCM • If you run blame, you’re most likely to find that you’re the one at fault. • Commit whenever you feel like you’ve reached a point that you’re complete, even (especially) if you might immediately rewrite the whole thing.