SlideShare uma empresa Scribd logo
1 de 60
Baixar para ler offline
CODE VERSION CONTROL
GIUSEPPE MASETTI
ESCI 872 – APPLIED TOOLS FOR OCEAN MAPPING – FUNDAMENTALS OF RESEARCH SOFTWARE DEVELOPMENT
Durham, NH – November 19 & 21, 2019
V1
WHAT IS CODE VERSION CONTROL?
A mechanism to manage changes to code over time.
• Tracking of per-file creation/modifications/deletion
• Ability to switch to past versions to fix bugs
• Facilitating concurrent work on the same project
Help to protect code from both catastrophes
and casual introduction of human error!
VERSION CONTROL SYSTEM (VCS)
Also known as:
Source Code Management (SCM)
Revision Control System (RCS)
CVS, Subversion, Mercurial, Bazaar, Git, etc.
Essential part of the every-day workflow
of a modern research software development team!
Copyright 2014 - 2019 Black Duck Software, Inc., CC-BY, https://www.openhub.net/repositories/compare
GIT .
• Command-line tool that tracks changes in
files and eases collaboration
• Created in 2005 by Linus Torvalds
• Free and open-source → GNU GPL v2
• Goals:
• Handling large project with speed/efficiency
• Data integrity
• Support for non-linear, distributed development
GFDL. Permission of Martin Streicher, Editor-in-
Chief, LINUXMAG.com. CC BY-SA 3.0
SVN VS. GIT
Git
Repo
Git
Repo
Git
Repo
SVN Central
Repo
Working
Copy
Working
Copy
Working
Copy
Centralized VCS Distributed VCS
IN LINUS’ OWN WORDS
2019 RhodeCode, https://rhodecode.com/insights/version-control-systems-2016
GIT → HOW TO INSTALL
Website → https://git-scm.com/
OPEN A WINDOWS SHELL,
THEN RETRIEVE THE GIT’S VERSION.
GIT → HOW TO SETUP
GIT SETUP
• Configure Git with your name and email
• git config --global user.email "your@email.com"
• git config --global user.name "your name"
• Check the current configuration
• git config --list
• The config commands only need to be done once
IN A WINDOWS SHELL
CONFIGURE GIT
WITH YOUR NAME AND EMAIL.
GIT → HOW TO USE
USING GIT
• Creating a new project
• git init → convert a directory into a Git repository (a .git directory is created)
• git add . → a snapshot of the directory content in a temporary staging area
• git commit –m "First commit" → permanently store the snapshot
• The init commands only need to be done once per project.
IN A WINDOWS SHELL
CREATE A GIT PROJECT, THEN
CREATE AND COMMIT A README FILE.
USING GIT
• Making code changes
• git add file0.py file1.py → stage new/updated files
• git diff → to list un-staged changes
• git diff --cached → to see what is ready to be committed
• git status → a brief summary of the repository situation
• git commit –m "A meaningful message" → finally commit your changes
USING GIT
• Making code changes
• git diff → to list un-staged changes
• git add file0.py file1.py → stage new/updated files
• git diff --cached → to see what is ready to be committed
• git status → a brief summary of the repository situation
• git commit –m "A meaningful message" → finally commit your changes
• When to commit code?
• Do it frequently
• Whenever you have reached a milestone/step in your task
FIRST CREATE AND COMMIT TWO SCRIPT FILES,
THEN EDIT ONE OF THEM AND
COMMIT THE CHANGES.
LOCAL CLOUD
Working
Directory
Staging
Area
Local
Repository
Remote
Repository
git add
git commit
git push
git fetch
git checkout
git merge
GIT HOSTING SERVICES
• Several sites offer services for hosting Git repositories
• Popular ones that are free for open-source projects:
GITHUB
• A social network for code share/collaboration
• It was acquired by Microsoft in 2018 for $7.5 billion.
GITHUB
• A social network for code share/collaboration
• It was acquired by Microsoft in 2018 for $7.5 billion.
• To push to the GitHub repository:
• Setup a remote (just once):
• git remote add origin https://github.com/giumas/myproject.git
• Push committed code (multiple times):
• git push origin master
• Reload project webpage
PUSH THE PREVIOUSLY CREATED PROJECT CODE
TO A GIT HOSTING SERVICE.
EPOM SERVER → JUPYTER TERMINAL
EPOM SERVER → CLONING GIT REPO
git clone https://github.com/giumas/myproject.git
EPOM SERVER → GIT REPO HISTORY
git log
EPOM SERVER → RUN A SCRIPT
ON THE EPOM SERVER
CLONE YOUR GIT REPOSITORY,
THEN EXECUTE ONE OF THE SCRIPTS.
LOCAL MACHINE GITHUB
Git
Repository
Git
Repository
git push
EPOM SERVER
git clone
Git
Repository
git push
git pull
git push
git pull
git push
COMMIT CHANGES ON YOUR LOCAL MACHINE,
THEN RETRIEVE THEM ON THE EPOM SERVER.
https://jrebel.com/rebellabs/git-commands-and-best-practices-cheat-sheet/
GIT GUI CLIENT → TORTOISEGIT
A windows shell extension to work with Git repositories.
• Shell integration
• Icon overlays
• Easy access to Git commands
TORTOISEGIT → ICON OVERLAYS
• Normal → all changes committed
• Modified → changes are present
• Staged → changes are ready to be committed
• Deleted → file/folder scheduled to be deleted
• Added → file/folder scheduled to be added
• Ignored → file/folder ignored by Git
• Conflict → there is a conflict between code versions
https://tortoisegit.org/docs/tortoisegit/tgit-dug-wcstatus.html#tgit-dug-wcstatus-1
TORTOISEGIT → SWITCH TO PAST COMMITS
TORTOISEGIT → SWITCH TO PAST COMMITS
TORTOISEGIT → SWITCH TO PAST COMMITS
TORTOISEGIT → SWITCH TO PAST COMMITS
USING TORTOISEGIT
SWITCH TO A PAST COMMIT,
THEN EXECUTE THE RESULTING SCRIPT.
QUESTIONS?
Contact me at: gmasetti@ccom.unh.edu

Mais conteúdo relacionado

Mais procurados

GitOps for Helm Users by Scott Rigby
GitOps for Helm Users by Scott RigbyGitOps for Helm Users by Scott Rigby
GitOps for Helm Users by Scott Rigby
Weaveworks
 
The Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitThe Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps Toolkit
Weaveworks
 

Mais procurados (20)

Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
 
Gitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operationsGitops: a new paradigm for software defined operations
Gitops: a new paradigm for software defined operations
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
 
GitOps for Helm Users by Scott Rigby
GitOps for Helm Users by Scott RigbyGitOps for Helm Users by Scott Rigby
GitOps for Helm Users by Scott Rigby
 
GitOps - Operation By Pull Request
GitOps - Operation By Pull RequestGitOps - Operation By Pull Request
GitOps - Operation By Pull Request
 
Gitops Hands On
Gitops Hands OnGitops Hands On
Gitops Hands On
 
CI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cdCI:CD in Lightspeed with kubernetes and argo cd
CI:CD in Lightspeed with kubernetes and argo cd
 
Git General
Git GeneralGit General
Git General
 
GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)GitOps Toolkit (Cloud Native Nordics Tech Talk)
GitOps Toolkit (Cloud Native Nordics Tech Talk)
 
The Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps ToolkitThe Power of GitOps with Flux & GitOps Toolkit
The Power of GitOps with Flux & GitOps Toolkit
 
Docker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
Docker New York City: From GitOps to a scalable CI/CD Pattern for KubernetesDocker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
Docker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
 
Git overview
Git overviewGit overview
Git overview
 
GitOps - Modern best practices for high velocity app dev using cloud native t...
GitOps - Modern best practices for high velocity app dev using cloud native t...GitOps - Modern best practices for high velocity app dev using cloud native t...
GitOps - Modern best practices for high velocity app dev using cloud native t...
 
Enabling GitOps - Architecture for Implementation
Enabling GitOps - Architecture for ImplementationEnabling GitOps - Architecture for Implementation
Enabling GitOps - Architecture for Implementation
 
Git & git hub
Git & git hubGit & git hub
Git & git hub
 
OpenStack and DevOps - DevOps Meetup
OpenStack and DevOps - DevOps MeetupOpenStack and DevOps - DevOps Meetup
OpenStack and DevOps - DevOps Meetup
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
GitOps and Kubernetes: a radical idea
GitOps and Kubernetes: a radical ideaGitOps and Kubernetes: a radical idea
GitOps and Kubernetes: a radical idea
 
GitOps with ArgoCD
GitOps with ArgoCDGitOps with ArgoCD
GitOps with ArgoCD
 
Git
GitGit
Git
 

Semelhante a ePOM - Fundamentals of Research Software Development - Code Version Control

Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
Derek Jacoby
 
Davinci git brown_bag
Davinci git brown_bagDavinci git brown_bag
Davinci git brown_bag
Jason Noble
 
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
Robert Lee-Cann
 

Semelhante a ePOM - Fundamentals of Research Software Development - Code Version Control (20)

Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Davinci git brown_bag
Davinci git brown_bagDavinci git brown_bag
Davinci git brown_bag
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-training
 
Data science Git management
Data science Git managementData science Git management
Data science Git 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 Git
 
Learn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levelsLearn Git - For Beginners and Intermediate levels
Learn Git - For Beginners and Intermediate levels
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Git
GitGit
Git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
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
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
 

Mais de Giuseppe Masetti

Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...
Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...
Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...
Giuseppe Masetti
 
The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...
The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...
The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...
Giuseppe Masetti
 
Backscatter Working Group Software Inter-comparison Project Requesting and Co...
Backscatter Working Group Software Inter-comparison ProjectRequesting and Co...Backscatter Working Group Software Inter-comparison ProjectRequesting and Co...
Backscatter Working Group Software Inter-comparison Project Requesting and Co...
Giuseppe Masetti
 
Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...
Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...
Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...
Giuseppe Masetti
 

Mais de Giuseppe Masetti (18)

e-learning Python for Ocean Mapping - Empowering the next generation of ocean...
e-learning Python for Ocean Mapping - Empowering the next generation of ocean...e-learning Python for Ocean Mapping - Empowering the next generation of ocean...
e-learning Python for Ocean Mapping - Empowering the next generation of ocean...
 
Leveraging Predictions from NOAA’s Oceanographic Forecast Models to Increase ...
Leveraging Predictions from NOAA’s Oceanographic Forecast Models to Increase ...Leveraging Predictions from NOAA’s Oceanographic Forecast Models to Increase ...
Leveraging Predictions from NOAA’s Oceanographic Forecast Models to Increase ...
 
ePOM - Fundamentals of Research Software Development - Introduction
ePOM - Fundamentals of Research Software Development - IntroductionePOM - Fundamentals of Research Software Development - Introduction
ePOM - Fundamentals of Research Software Development - Introduction
 
ePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
ePOM - Intro to Ocean Data Science - Raster and Vector Data FormatsePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
ePOM - Intro to Ocean Data Science - Raster and Vector Data Formats
 
ePOM - Intro to Ocean Data Science - Scientific Computing
ePOM - Intro to Ocean Data Science - Scientific ComputingePOM - Intro to Ocean Data Science - Scientific Computing
ePOM - Intro to Ocean Data Science - Scientific Computing
 
ePOM - Intro to Ocean Data Science - Data Visualization
ePOM - Intro to Ocean Data Science - Data VisualizationePOM - Intro to Ocean Data Science - Data Visualization
ePOM - Intro to Ocean Data Science - Data Visualization
 
ePOM - Intro to Ocean Data Science - Object-Oriented Programming
ePOM - Intro to Ocean Data Science - Object-Oriented ProgrammingePOM - Intro to Ocean Data Science - Object-Oriented Programming
ePOM - Intro to Ocean Data Science - Object-Oriented Programming
 
AusSeabed workshop - Pydro and Hydroffice - Days 2 and 3
AusSeabed workshop - Pydro and Hydroffice - Days 2 and 3AusSeabed workshop - Pydro and Hydroffice - Days 2 and 3
AusSeabed workshop - Pydro and Hydroffice - Days 2 and 3
 
AusSeabed workshop - Pydro and Hydroffice - Day 1
AusSeabed workshop - Pydro and Hydroffice - Day 1AusSeabed workshop - Pydro and Hydroffice - Day 1
AusSeabed workshop - Pydro and Hydroffice - Day 1
 
Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...
Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...
Hydrographic Survey Validation and Chart Adequacy Assessment Using Automated ...
 
The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...
The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...
The Open Backscatter Toolchain (OpenBST) project: towards an open-source and ...
 
Pydro & HydrOffice: Open Tools for Ocean Mappers
Pydro & HydrOffice: Open Tools for Ocean MappersPydro & HydrOffice: Open Tools for Ocean Mappers
Pydro & HydrOffice: Open Tools for Ocean Mappers
 
INMARTECH 2018 - G.Masetti & P.Johnson - Sound Speed Management and Environme...
INMARTECH 2018 - G.Masetti & P.Johnson - Sound Speed Management and Environme...INMARTECH 2018 - G.Masetti & P.Johnson - Sound Speed Management and Environme...
INMARTECH 2018 - G.Masetti & P.Johnson - Sound Speed Management and Environme...
 
Backscatter Working Group Software Inter-comparison Project Requesting and Co...
Backscatter Working Group Software Inter-comparison ProjectRequesting and Co...Backscatter Working Group Software Inter-comparison ProjectRequesting and Co...
Backscatter Working Group Software Inter-comparison Project Requesting and Co...
 
Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...
Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...
Shallow Survey 2018 - Applications of Sonar Detection Uncertainty for Survey ...
 
Bathymetric Attributed Grid (BAG) format
Bathymetric Attributed Grid (BAG) formatBathymetric Attributed Grid (BAG) format
Bathymetric Attributed Grid (BAG) format
 
Masetti et al. - Bathymetric and reflectivity-derived data fusion for Prelimi...
Masetti et al. - Bathymetric and reflectivity-derived data fusion for Prelimi...Masetti et al. - Bathymetric and reflectivity-derived data fusion for Prelimi...
Masetti et al. - Bathymetric and reflectivity-derived data fusion for Prelimi...
 
HydrOffice: past, present, and future.
HydrOffice: past, present, and future.HydrOffice: past, present, and future.
HydrOffice: past, present, and future.
 

Último

Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
Silpa
 
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
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
Silpa
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
Silpa
 
biology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGYbiology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGY
1301aanya
 
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Silpa
 
LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.
Silpa
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
MohamedFarag457087
 
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
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
Silpa
 
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
 

Último (20)

Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditions
 
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
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
 
Dr. E. Muralinath_ Blood indices_clinical aspects
Dr. E. Muralinath_ Blood indices_clinical  aspectsDr. E. Muralinath_ Blood indices_clinical  aspects
Dr. E. Muralinath_ Blood indices_clinical aspects
 
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLGwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
 
FAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical ScienceFAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical Science
 
biology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGYbiology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGY
 
Proteomics: types, protein profiling steps etc.
Proteomics: types, protein profiling steps etc.Proteomics: types, protein profiling steps etc.
Proteomics: types, protein profiling steps etc.
 
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.Cyathodium bryophyte: morphology, anatomy, reproduction etc.
Cyathodium bryophyte: morphology, anatomy, reproduction etc.
 
LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
 
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
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
Zoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdfZoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdf
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
 
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
 

ePOM - Fundamentals of Research Software Development - Code Version Control

  • 1. CODE VERSION CONTROL GIUSEPPE MASETTI ESCI 872 – APPLIED TOOLS FOR OCEAN MAPPING – FUNDAMENTALS OF RESEARCH SOFTWARE DEVELOPMENT Durham, NH – November 19 & 21, 2019 V1
  • 2. WHAT IS CODE VERSION CONTROL? A mechanism to manage changes to code over time. • Tracking of per-file creation/modifications/deletion • Ability to switch to past versions to fix bugs • Facilitating concurrent work on the same project Help to protect code from both catastrophes and casual introduction of human error!
  • 3. VERSION CONTROL SYSTEM (VCS) Also known as: Source Code Management (SCM) Revision Control System (RCS) CVS, Subversion, Mercurial, Bazaar, Git, etc. Essential part of the every-day workflow of a modern research software development team!
  • 4. Copyright 2014 - 2019 Black Duck Software, Inc., CC-BY, https://www.openhub.net/repositories/compare
  • 5. GIT . • Command-line tool that tracks changes in files and eases collaboration • Created in 2005 by Linus Torvalds • Free and open-source → GNU GPL v2 • Goals: • Handling large project with speed/efficiency • Data integrity • Support for non-linear, distributed development GFDL. Permission of Martin Streicher, Editor-in- Chief, LINUXMAG.com. CC BY-SA 3.0
  • 6. SVN VS. GIT Git Repo Git Repo Git Repo SVN Central Repo Working Copy Working Copy Working Copy Centralized VCS Distributed VCS
  • 9. GIT → HOW TO INSTALL
  • 11.
  • 12.
  • 13. OPEN A WINDOWS SHELL, THEN RETRIEVE THE GIT’S VERSION.
  • 14. GIT → HOW TO SETUP
  • 15. GIT SETUP • Configure Git with your name and email • git config --global user.email "your@email.com" • git config --global user.name "your name" • Check the current configuration • git config --list • The config commands only need to be done once
  • 16. IN A WINDOWS SHELL CONFIGURE GIT WITH YOUR NAME AND EMAIL.
  • 17. GIT → HOW TO USE
  • 18. USING GIT • Creating a new project • git init → convert a directory into a Git repository (a .git directory is created) • git add . → a snapshot of the directory content in a temporary staging area • git commit –m "First commit" → permanently store the snapshot • The init commands only need to be done once per project.
  • 19.
  • 20. IN A WINDOWS SHELL CREATE A GIT PROJECT, THEN CREATE AND COMMIT A README FILE.
  • 21. USING GIT • Making code changes • git add file0.py file1.py → stage new/updated files • git diff → to list un-staged changes • git diff --cached → to see what is ready to be committed • git status → a brief summary of the repository situation • git commit –m "A meaningful message" → finally commit your changes
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. USING GIT • Making code changes • git diff → to list un-staged changes • git add file0.py file1.py → stage new/updated files • git diff --cached → to see what is ready to be committed • git status → a brief summary of the repository situation • git commit –m "A meaningful message" → finally commit your changes • When to commit code? • Do it frequently • Whenever you have reached a milestone/step in your task
  • 28. FIRST CREATE AND COMMIT TWO SCRIPT FILES, THEN EDIT ONE OF THEM AND COMMIT THE CHANGES.
  • 30. GIT HOSTING SERVICES • Several sites offer services for hosting Git repositories • Popular ones that are free for open-source projects:
  • 31. GITHUB • A social network for code share/collaboration • It was acquired by Microsoft in 2018 for $7.5 billion.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. GITHUB • A social network for code share/collaboration • It was acquired by Microsoft in 2018 for $7.5 billion. • To push to the GitHub repository: • Setup a remote (just once): • git remote add origin https://github.com/giumas/myproject.git • Push committed code (multiple times): • git push origin master • Reload project webpage
  • 37.
  • 38.
  • 39. PUSH THE PREVIOUSLY CREATED PROJECT CODE TO A GIT HOSTING SERVICE.
  • 40. EPOM SERVER → JUPYTER TERMINAL
  • 41. EPOM SERVER → CLONING GIT REPO git clone https://github.com/giumas/myproject.git
  • 42. EPOM SERVER → GIT REPO HISTORY git log
  • 43. EPOM SERVER → RUN A SCRIPT
  • 44. ON THE EPOM SERVER CLONE YOUR GIT REPOSITORY, THEN EXECUTE ONE OF THE SCRIPTS.
  • 45. LOCAL MACHINE GITHUB Git Repository Git Repository git push EPOM SERVER git clone Git Repository git push git pull git push git pull git push
  • 46.
  • 47.
  • 48.
  • 49. COMMIT CHANGES ON YOUR LOCAL MACHINE, THEN RETRIEVE THEM ON THE EPOM SERVER.
  • 51. GIT GUI CLIENT → TORTOISEGIT A windows shell extension to work with Git repositories.
  • 52.
  • 53. • Shell integration • Icon overlays • Easy access to Git commands
  • 54. TORTOISEGIT → ICON OVERLAYS • Normal → all changes committed • Modified → changes are present • Staged → changes are ready to be committed • Deleted → file/folder scheduled to be deleted • Added → file/folder scheduled to be added • Ignored → file/folder ignored by Git • Conflict → there is a conflict between code versions https://tortoisegit.org/docs/tortoisegit/tgit-dug-wcstatus.html#tgit-dug-wcstatus-1
  • 55. TORTOISEGIT → SWITCH TO PAST COMMITS
  • 56. TORTOISEGIT → SWITCH TO PAST COMMITS
  • 57. TORTOISEGIT → SWITCH TO PAST COMMITS
  • 58. TORTOISEGIT → SWITCH TO PAST COMMITS
  • 59. USING TORTOISEGIT SWITCH TO A PAST COMMIT, THEN EXECUTE THE RESULTING SCRIPT.
  • 60. QUESTIONS? Contact me at: gmasetti@ccom.unh.edu