Version control with git Eike Mueller, University of Bath Wed 26 th - - PowerPoint PPT Presentation

version control with git
SMART_READER_LITE
LIVE PREVIEW

Version control with git Eike Mueller, University of Bath Wed 26 th - - PowerPoint PPT Presentation

Version control with git Eike Mueller, University of Bath Wed 26 th Sep 2018 Eike Mueller, University of Bath Version control with git Why version control? Piled Higher and Deeper by Jorge Cham, http://www.phdcomics.com Eike Mueller,


slide-1
SLIDE 1

Version control with git

Eike Mueller, University of Bath Wed 26th Sep 2018

Eike Mueller, University of Bath Version control with git

slide-2
SLIDE 2

Why version control?

“Piled Higher and Deeper” by Jorge Cham, http://www.phdcomics.com

Eike Mueller, University of Bath Version control with git

slide-3
SLIDE 3

Version control Benefits of Version control

Systematic 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

slide-4
SLIDE 4

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 changes Eike Mueller, University of Bath Version control with git

slide-5
SLIDE 5

Basic concepts

Tracking of changes Collaborating Merging and resolving conflicts

All figures from Software Carpentry webpage

Eike Mueller, University of Bath Version control with git

slide-6
SLIDE 6

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 experimentation Selective commits (staging area) Very powerful

Not the easiest system to learn

We’ll only cover the basics here Lots of online resources Graphical interfaces (e.g. SourceTree)

Documentation

Git book: http://git-scm.com/book/en/v2 Reference: http://git-scm.com/docs

Eike Mueller, University of Bath Version control with git

slide-7
SLIDE 7

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 webpage

http://software-carpentry.org/

Eike Mueller, University of Bath Version control with git

slide-8
SLIDE 8

Eike Mueller, University of Bath Version control with git

slide-9
SLIDE 9

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

slide-10
SLIDE 10

Eike Mueller, University of Bath Version control with git

slide-11
SLIDE 11

Wrapup Summary

Track changes and collaborate Pays off even for small projects Small number of commands

1

git log

2

git status

3

git add

4

git commit

5

git clone/push/pull

There are graphical tools (e.g. SourceTree for Mac/Win) Other hosting sites: BitBucket, GitLab

More details

Git book: http://git-scm.com/book/en/v2 Reference: http://git-scm.com/docs

Eike Mueller, University of Bath Version control with git

slide-12
SLIDE 12

Advanced topics Advanced topics

What 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

slide-13
SLIDE 13

Branches A Quick glance at branches

Branches allow organised simultaneous development by collecting related 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

slide-14
SLIDE 14

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