version control with git
play

Version Control with Git Before we start Sign up at github.com 1 - PowerPoint PPT Presentation

Version Control with Git Before we start Sign up at github.com 1 What is Version Control? (AKA revision control, source control) Tracks changes to files Any file can be tracked Text (.txt, .csv, .py, .c, .r etc.) works best


  1. Version Control with Git ● Before we start ● Sign up at github.com 1

  2. What is Version Control? (AKA revision control, source control) ● Tracks changes to files ● Any file can be tracked ● Text (.txt, .csv, .py, .c, .r etc.) works best ● These allow smart difg / merge etc. 2

  3. Why Use Version Control? #1 ● A more efgicient backup ● Reproducibility 3

  4. Why Use Version Control? #2 ● Teamwork 4

  5. Version Control Tracks Changes ● Changes are tracked sequentially 5

  6. Version Control Tracks Changes ● Difgerent versions can be saved 6

  7. Version Control Tracks Changes ● Multiple versions can be merged 7

  8. Version Control Alternatives ● Subversion (svn) - Centralised ● Mercurial (hg) - Distributed ● Git (git) – Distributed ● Most widely used in academia! ● N.B. GitHub != git ● Alternatives like GitLab exist 8

  9. Local Configuration ● git config 11

  10. Getting Demo Files ● git clone https://github.com/sofuwaresaved/2020- 04-30-ramp-swc 11

  11. Creating a Repository ● git init ● git status 12

  12. Tracking Changes to Files ● git add ● git commit 13

  13. Git – add and commit Staging Workspace Local Repo Area add commit Visible File System Git Repository 17

  14. Exploring History #1 ● git log ● git difg 15

  15. Git – difg #1 Staging Workspace Local Repo Area diff diff --staged Visible File System Git Repository 17

  16. Git – difg #2 Staging Workspace Local Repo Area diff sl33v51a sl33v51a f22b25e g31a45d HEAD ~2 HEAD ~1 diff HEAD HEAD Visible File System Git Repository 17

  17. Restoring Files ● git checkout 15

  18. Git - restoration Staging Workspace Local Repo Area f22b25e sl33v51a checkout f22b25e f22b25e g31a45d HEAD ~2 HEAD ~1 g31a45d checkout HEAD HEAD Visible File System Git Repository 17

  19. Git Workflow – Local Repo. 17

  20. Collaboration Sarah's computer Fred's computer /home/sarah/planets /home/fred/planets A B 17

  21. Collaboration: Remote Repositories ● Sign in https://github.com/ ● Create repository ● git remote add ● git push

  22. Collaboration: Branches

  23. Collaboration: Creating Branches ● git branch dev ● git checkout dev

  24. Collaboration: Creating Branches 2 ● Create rainfall_conversion.py ● git add rainfall_conversion.py ● git commit -m

  25. Git Workflow – Remote Repo. 21

  26. Collaboration: Branches

  27. Collaboration: Feature Branch Exercise ● Check out ‘dev’ ● Create a new branch called ‘docs’ ● Create and add README.md ● Push to GitHub and merge back to ‘dev’ ● Pull the changes back to your computer

  28. What next? ● Ignore files / Merging ● https://sofuware-carpentry.org 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend