SlideShare ist ein Scribd-Unternehmen logo
1 von 111
Downloaden Sie, um offline zu lesen
for me, for you.
Git is version control.
What is version control?
The problem:
Backups
Organization
Collaboration
h p://www.phdcomics.com/comics/archive.php?comicid=1531
Thesis Thesis Thesis
v1 v7-3
v43_SN_
comments_
Sept_27_
response
Thesis_Final
Sept17_2013 Oct12_2013 Jan07_2014
Manuscript
FinalVersion Nature_Sub ObscureJournal
1
1 2
1 2
1 2
git commit -m "Initial commit."
the program
the git command
the command options git commit
add
checkout
reset
branch
merge
clone
pull
push
Manuscript
manuscript.tex
Figure1.pdf
Figure2.pdf
repository
Outbox
staging area
working copy
Manuscript
git checkout …
Outbox
manuscript.tex
• added 2 paragraphs
• deleted 3 lines
• moved 4 lines down
• ...
git add …
git commit …
Outbox
commit: 83296a31...
author: Steven Hamblin
Date: Friday May 9, 20:03:39 2014
Fixed introduction in manuscript.tex
Manuscript
git checkout …
Outbox
manuscript.tex
• added 2 paragraphs
• deleted 3 lines
• moved 4 lines down
• ...
git add …
Outbox
commit: 83296a31...
author: Steven Hamblin
Date: Friday May 9, 20:03:39 2014
Fixed introduction in manuscript.tex
git commit …
Let’s try it.
Outbox
manuscript.tex
• added 2 paragraphs
• deleted 3 lines
• moved 4 lines down
• ...
git add …
git commit …
Outbox
commit: 83296a31...
author: Steven Hamblin
Date: Friday May 9, 20:03:39 2014
Fixed introduction in manuscript.tex
commit size
tree
author
committer
09f0e...
Steven
Steven
Initial commit.
tree size
blob
blob
blob
25351 manuscript.txt
README.md
3a44f
8762e
Figure1.pdf
blob size
This is going to be an
AWESOME NATURE PAPER!
blob size
... binary data ...
blob size
## README
This is the README for
my AWESOME NATURE PAPER.
de102...
09f0e...
25351...
3a44f...
8762e...
git commit + git add
Outbox
commit: 83296a31...
author: Steven Hamblin
Date: Friday May 9, 20:03:39 2014
Fixed introduction in manuscript.tex
Outbox
manuscript.tex
• added 2 paragraphs
• deleted 3 lines
• moved 4 lines down
• ...
git commit -a —>
commit size
tree
author
committer
09f0e...
Steven
Steven
Initial commit.
de102...
commit size
tree
author
committer
47ae6...
Steven
Steven
Added my plan
d0100... c315c...
parent de102...
commit size
tree
author
committer
7cae3...
Steven
Steven
Added note of caution.
parent c315c...
Snapshot CSnapshot BSnapshot A
Branching.
Snapshot CSnapshot BSnapshot A
de102 d0100 c315c
master
de102 d0100 c315c
master
PNAS
de102 d0100 c315c
master
PNAS
HEAD
Manuscript
master
PNAS
git checkout
de102 d0100 c315c
master
PNAS
HEAD
de102 d0100 c315c
master
PNAS
HEAD
fc547
de102 d0100 c315c
master
PNAS
HEAD
fc547
de102 d0100 c315c
master
PNAS
HEAD
fc547
b755a
de102 d0100 c315c
master
PNAS
HEAD
fc547
b755a 20bb1
Exercise
Try this command:
!
git log --graph --pretty --abbrev-commit
Exercise
1. Checkout the PNAS branch again.
2. Create a new file with some
references in it. Call it refs.txt.
3. Add the file, then commit it.
Exercise
1. Now, checkout master again.
2. Merge the PNAS branch into
master again.
Commit early, commit o en!
Branch early, branch o en!
d0100
git reset
git revert
git diff
git reset - - hard <commit>
git reset - - so <commit>
git reset - - hard <commit>
git reset - - so <commit>
- -hard throws away changes, moves HEAD
- -so keeps changes, moves HEAD
de102 d0100 c315c
master
HEAD
b755a
de102 d0100 c315c
master
HEAD
deleted
Exercise
1. Make changes and commit, twice.
2. Make uncommi ed changes.
3. Use git reset to throw away the
uncommi ed changes.
Exercise
1. Make more uncommi ed changes.
2. Use git reset to roll back the
repository without losing the
uncommi ed changes.
git stash
Exercise
1. Make uncommi ed changes.
2. Stash those changes
3. Switch branches. Make changes
and commit.
4. Switch back and retrieve your
stashed changes.
Collaboration
user 1's
local repository
user 2's
local repository
user 1 user 2
remote repository
e.g. GitHub, Bitbucket
git clone
C1
Outbox
git push
git pull
git pullfetch
merge
Exercise
1. Create a GitHub account
(github.com)
2. Create a repository on GitHub.
3. Clone the repository to your
machine.
Exercise
1. Make some local changes and
commit them.
2. Push the changes to your remote
repository.
Exercise
1. Go to github.com and make some
changes on the remote side.
2. Pull the changes into your local.
Exercise
1. Advanced: change the same file
locally and remotely to create a
merge conflict.
2. Pull and resolve the conflict.
Exercise
1. Go to h p://pco le.github.io/
learnGitBranching/
2. Do the “Main” Introduction
sequence and the first “Remote”
sequence.
Share and enjoy!
Steven Hamblin (steven.hamblin@gmail.com)
h p://winawer.org

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
git and github
git and githubgit and github
git and github
 
Git tutorial
Git tutorial Git tutorial
Git tutorial
 
Git basic
Git basicGit basic
Git basic
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Learning git
Learning gitLearning git
Learning git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git basics
Git basicsGit basics
Git basics
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git learning
Git learningGit learning
Git learning
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 

Ähnlich wie Git introduction workshop for scientists

Ähnlich wie Git introduction workshop for scientists (20)

Git workshop
Git workshopGit workshop
Git workshop
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Use Git like a pro - condensed
Use Git like a pro - condensedUse Git like a pro - condensed
Use Git like a pro - condensed
 
Git: Overview, Pitfalls, Best Practices
Git: Overview, Pitfalls, Best PracticesGit: Overview, Pitfalls, Best Practices
Git: Overview, Pitfalls, Best Practices
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control system
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Introduce to Git and Jenkins
Introduce to Git and JenkinsIntroduce to Git and Jenkins
Introduce to Git and Jenkins
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Advanced Git Techniques: Subtrees, Grafting, and Other Fun Stuff
Advanced Git Techniques: Subtrees, Grafting, and Other Fun StuffAdvanced Git Techniques: Subtrees, Grafting, and Other Fun Stuff
Advanced Git Techniques: Subtrees, Grafting, and Other Fun Stuff
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
Working with Git
Working with GitWorking with Git
Working with Git
 

Mehr von Steven Hamblin

Mehr von Steven Hamblin (19)

Ideal freeducks coolshittalk1-sh-nov14-2014
Ideal freeducks coolshittalk1-sh-nov14-2014Ideal freeducks coolshittalk1-sh-nov14-2014
Ideal freeducks coolshittalk1-sh-nov14-2014
 
Oxford Job Talk
Oxford Job TalkOxford Job Talk
Oxford Job Talk
 
Animals in the zoo
Animals in the zooAnimals in the zoo
Animals in the zoo
 
ISBE 2012
ISBE 2012ISBE 2012
ISBE 2012
 
Phd Defence talk
Phd Defence talkPhd Defence talk
Phd Defence talk
 
Phd Seminar talk
Phd Seminar talkPhd Seminar talk
Phd Seminar talk
 
Examen talk
Examen talkExamen talk
Examen talk
 
ISBE 2010
ISBE 2010ISBE 2010
ISBE 2010
 
Seminar talk, 2008
Seminar talk, 2008Seminar talk, 2008
Seminar talk, 2008
 
Phd Proposal
Phd ProposalPhd Proposal
Phd Proposal
 
GRECA talk
GRECA talkGRECA talk
GRECA talk
 
MSc Thesis
MSc ThesisMSc Thesis
MSc Thesis
 
Cog Sem 2007
Cog Sem 2007Cog Sem 2007
Cog Sem 2007
 
Pecha Kucha: Visual design in science
Pecha Kucha: Visual design in sciencePecha Kucha: Visual design in science
Pecha Kucha: Visual design in science
 
ABS 2006
ABS 2006ABS 2006
ABS 2006
 
Giving scientific talks
Giving scientific talksGiving scientific talks
Giving scientific talks
 
Academics and social media (GSA 2013 Talk)
Academics and social media (GSA 2013 Talk)Academics and social media (GSA 2013 Talk)
Academics and social media (GSA 2013 Talk)
 
Human Evolution Talk
Human Evolution TalkHuman Evolution Talk
Human Evolution Talk
 
Viral evolution, some economic approaches
Viral evolution, some economic approachesViral evolution, some economic approaches
Viral evolution, some economic approaches
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Sérgio Sacani
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
MohamedFarag457087
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
Areesha Ahmad
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
seri bangash
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
levieagacer
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
NazaninKarimi6
 

Kürzlich hochgeladen (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
 
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptxPSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
 
Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.
 
Introduction to Viruses
Introduction to VirusesIntroduction to Viruses
Introduction to Viruses
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRLKochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
 
Grade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsGrade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its Functions
 
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
 
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
 

Git introduction workshop for scientists