version control with git · wrapup summary track changes and collaborate pays o even for small...
TRANSCRIPT
![Page 1: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/1.jpg)
Version control with git
Eike Mueller, University of Bath
Wed 26th Sep 2018
Eike Mueller, University of Bath Version control with git
![Page 2: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/2.jpg)
Why version control?
“Piled Higher and Deeper” by Jorge Cham, http://www.phdcomics.com
Eike Mueller, University of Bath Version control with git
![Page 3: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/3.jpg)
Version control
Benefits of Version controlSystematic and controlled Backup
Collaborate: work on same document simultaneously
Keep track of changes (who introduced feature X and why?)
Try out changes and revert to working version(“undo”-button)
Work on project on different machines
Simplifies debugging
Reproducibility
What’s the catch?Have to learn a few commands to interact with git
Enforces organised approach
Eike Mueller, University of Bath Version control with git
![Page 4: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/4.jpg)
Applications
Version control can be be applied to:Source code (matlab, Fortran, C, Python, . . . )
LaTeX (papers, reports, your thesis, . . . )
Raw results (e.g. CSV files with numerical values)
Any text files1
Reproducibility: Link results to particular code version
1Binary files work as well, but harder to track changesEike Mueller, University of Bath Version control with git
![Page 5: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/5.jpg)
Basic concepts
Tracking of changes
Collaborating Merging and resolvingconflicts
All figures from Software Carpentry webpage
Eike Mueller, University of Bath Version control with git
![Page 6: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/6.jpg)
git
Why git?de-facto standard now (supersedes subversion, CVS, . . . )
Several nice features:
Work remotely (distributed system allows offline commits)Simple and lightweight branching⇒ encourages experimentationSelective commits (staging area)Very powerful
Not the easiest system to learn
We’ll only cover the basics hereLots of online resourcesGraphical interfaces (e.g. SourceTree)
DocumentationGit book: http://git-scm.com/book/en/v2
Reference: http://git-scm.com/docs
Eike Mueller, University of Bath Version control with git
![Page 7: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/7.jpg)
Overview
Session 1 (Basics) 13:45h - 15:00h
Creating a git repository
Tracking changes
Exploring history
— break —
Session 2 (Collaborating) 15:30h - 17:00h
Working with remotes (github)
Collaborating and resolving conflicts
Wrapup and advanced concepts (branching, merging, . . . )
Resources available at2
http://people.bath.ac.uk/rjg20/training/
2All material used is based on Software Carpentry webpagehttp://software-carpentry.org/
Eike Mueller, University of Bath Version control with git
![Page 8: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/8.jpg)
Eike Mueller, University of Bath Version control with git
![Page 9: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/9.jpg)
github
Create a github account
go to https://github.com/
click here
Use your University email address
Eike Mueller, University of Bath Version control with git
![Page 10: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/10.jpg)
Eike Mueller, University of Bath Version control with git
![Page 11: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/11.jpg)
Wrapup
SummaryTrack changes and collaborate
Pays off even for small projects
Small number of commands1 git log2 git status3 git add4 git commit5 git clone/push/pull
There are graphical tools (e.g. SourceTree for Mac/Win)
Other hosting sites: BitBucket, GitLab
More detailsGit book: http://git-scm.com/book/en/v2
Reference: http://git-scm.com/docs
Eike Mueller, University of Bath Version control with git
![Page 12: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/12.jpg)
Advanced topics
Advanced topicsWhat actually is a commit?
Branching and merging, the rebase command
Rewriting history
Pull requests
Advanced workflows
Forking repositories
Tags
Stashing
Eike Mueller, University of Bath Version control with git
![Page 13: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/13.jpg)
Branches
A Quick glance at branchesBranches allow organised simultaneous development by collectingrelated commits
Bugfix
New untested feature
Master branch(guaranteed to work)
Usually:
1 concept/feature = 1 branch
https://git-scm.com/book
git branch = lightweight pointer
Eike Mueller, University of Bath Version control with git
![Page 14: Version control with git · Wrapup Summary Track changes and collaborate Pays o even for small projects Small number of commands 1 git log 2 git status 3 git add 4 git commit 5 git](https://reader034.vdocument.in/reader034/viewer/2022050402/5f800e0b40d57b57fe18ec51/html5/thumbnails/14.jpg)
Branches
Merge and resolve conflicts
Basic merge and rebase
Pull requests on github and BitBucket
Code review
Can limit access to master branch
https://git-scm.com/book
Eike Mueller, University of Bath Version control with git