version control for scientists · 2016-05-26 · collaborating with git you can share commit...
TRANSCRIPT
![Page 1: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/1.jpg)
Version Control for Scientists
Thomas K. Baldwin
![Page 2: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/2.jpg)
Version Control is an organizational skill
• keep files in order
• keep files backed up
• collaborate
for computer programs, papers, presentations…
![Page 3: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/3.jpg)
• nvpaper.doc
• nvpaper_1.doc
• nvpaper_1_hailin.doc
• nvpaper_2.doc
• nvpaper_2.1.doc
• nvpaper_2.1_naturephysics.doc
• nvpaper_final.doc
• nvpaper_final_submitted.doc
![Page 4: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/4.jpg)
![Page 5: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/5.jpg)
You’re Reinventing the Wheel
The solution exists, and it is called Version Control
• a program that keeps track of files as they change
• invented for software development, but useful for any set of changing files
![Page 6: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/6.jpg)
Version control programs
• Distributed: Git, Mercurial (hg), Bazaar (bzr)
• older: Subversion (svn), CVS, RCS
• Built-in to some file formats (e.g. Word)
The emerging standard is git.
![Page 7: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/7.jpg)
The Repository• A folder with stored
history
• past versions stored in hidden subfolder (.hg or .git)
• only added files are tracked
• snapshots are saved when you make a commit
![Page 8: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/8.jpg)
CommitsA snapshot of tracked files at a point in time.
• a unique identifier (SHA1 hash)
• a link to parent commit
• name of author/committer
• a descriptive message
The commit message should briefly describe how the snapshot differs from
the parent.
![Page 9: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/9.jpg)
![Page 10: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/10.jpg)
Demo
![Page 11: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/11.jpg)
baldwint.com/vcs/important.tex
• Make a repository containing this file
• Add the file and make an initial commit
• Fix typos and commit
• Change author and commit
• Change date and commit
![Page 12: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/12.jpg)
Advanced Topics
• keep files in order
• keep files backed up
• collaborate
![Page 13: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/13.jpg)
Branches and Merges
branches: for dead ends merges: for software dev
clones / forks: wholesale copies of a repository
A B C
D E
F G
A B C
D E
F G’
![Page 14: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/14.jpg)
Cloning, Pushing, Pulling
• Cloning copies a repository and its history.
• This creates a fork. (it’s a backup!)
• A push transfers changes from a local repository to a remote one. (A pull is the opposite of a push.)
• Pushes and pulls are done one branch at a time.
![Page 15: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/15.jpg)
github.com
• clone your practice repository to github (“publish”)
• View it on the web
• Make a change to the local repository and commit it
• Is it on the web?
• push (“sync”) your new change to the remote copy
![Page 16: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/16.jpg)
Collaborating with git
You can share commit privileges with others, and both collaborate on the same repository.
• Use github as an “official copy” and pull frequently
• If working simultaneously, use branches.
You can always commit to your own forks, but you’ll need commit privileges to push them back.
![Page 17: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/17.jpg)
github.com/baldwint/uomlweb
• clone this repository to your computer
• Make a change and commit it
• one at a time, push your change to the remote copy
• I have no idea if this will work
![Page 18: Version Control for Scientists · 2016-05-26 · Collaborating with git You can share commit privileges with others, and both collaborate on the same repository. • Use github as](https://reader033.vdocuments.mx/reader033/viewer/2022042013/5e7323ed29b6ca6286499be8/html5/thumbnails/18.jpg)
Pro Git (free, official ebook): https://progit.org
Git for scientists: http://nyuccl.org/pages/gittutorial/
Try git without installing: https://try.github.io/