Me: Dr James Hetherington -- UCL Research Software Development Team -- blogs.ucl.ac.uk/research-software-development/blogs.ucl.ac.uk/research-software-development/

Slides:



Advertisements
Similar presentations
Intro to Version Control Have you ever …? Had an application crash and lose ALL of your work Made changes to a file for the worse and wished you could.
Advertisements

1. What is Subversion? Why do we need CM? Basic concepts Repositories Options Setup Clients Options Setup Operation Troubleshooting Slide 2.
Version Control 1.  Version control (or revision control) is the term for the management of source files, and all of the intermediate stages as development.
Version Control Systems Phil Pratt-Szeliga Fall 2010.
Source Control Repositories for Enabling Team Working Svetlin Nakov Telerik Corporation
SubVersioN – the new Central Service at DESY by Marian Gawron.
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Version control Using Git 1Version control, using Git.
Source Control Repositories for Team Collaboration: SVN, TFS, Git Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training.
Programming in Teams And how to manage your code.
Introduction to Version Control with SVN & Git CSC/ECE 517, Fall 2012 Titus Barik & Ed Gehringer, with help from Gaurav.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Introduction to Version Control
Why you should be using Version Control. Matt Krass Electrical/Software Engineer November 22, 2014.
Source Control Repositories for Team Collaboration: SVN, TFS, Git.
With Mercurial and Progress.   Introduction  What is version control ?  Why use version control ?  Centralised vs. Distributed  Why Mercurial ?
Git – versioning and managing your software L. Grewe.
Branching. Version Control - Branching A way to write code without affecting the rest of your team Merge branches to integrate your changes.
Version control Using Git Version control, using Git1.
Drexel University Software Engineering Research Group Git for SE101 1.
Version Control. How do you share code? Discussion.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
Version Control.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Introduction to Version Control with Git CSC/ECE 517, Fall 2014 A joint project of the CSC/ECE 517 staff, including Titus Barik, Gaurav Tungatkar, Govind.
Version Control Systems. Version Control Manage changes to software code – Preserve history – Facilitate multiple users / versions.
Sofia Event Center May 2014 Martin Kulov Git For TFS Developers.
Version Control System Lisa Palathingal 03/04/2015.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Version Control and SVN ECE 297. Why Do We Need Version Control?
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
CS 160 and CMPE/SE 131 Software Engineering February 16 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Using Git with collaboration, code review, and code management for open source and private projects. & Using Terminal to create, and push commits to repositories.
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
1 Subversion Kate Hedstrom April Version Control Software System for managing source files –For groups of people working on the same code –When.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Introduction to GitHub
Information Systems and Network Engineering Laboratory II
11 Version control (part 2)
LECTURE 2: Software Configuration Management
Version Control.
Git Practice walkthrough.
Version control, using Git
Software Engineering for Data Scientists
Version Control with Git and GitHub
Version Control System
Version Control with Git accelerated tutorial for busy academics
Distributed Version Control with git
Source Code Management
LECTURE 3: Software Configuration Management
The Big Picture
Git CS Fall 2018.
Version Control System - Git
Version control with Git
Patrick Cozzi University of Pennsylvania CIS Fall 2012
Version Control with Git and GitHub
Introduction to The Git Version Control System
Presentation transcript:

Me: Dr James Hetherington -- UCL Research Software Development Team -- blogs.ucl.ac.uk/research-software-development/blogs.ucl.ac.uk/research-software-development/ -- programming

Version Control and Issue Tracking Managing code inventory –“When did I introduce this bug?” –Undoing mistakes Working with other programmers –How can I merge my work with Jim’s? What’s the most important bug to fix next?

What is version control? (Solo version) Do some programming > my_vcs commit Program some more –Realise mistake > my_vcs rollback –Mistake is undone Syntax here is example only!

What is version control? (team version) … wait … Join the team > my_vcs checkout do some programming > my_vcs commit Do some programming … more programming… > my_vcs commit … more programming … > my_vcs commit Error again… Create some code > my_vcs commit …wait… >my_vcs update Do some programming … program some more > my_vcs commit Oh Noes! Error message! > my_vcs update > my_vcs merge > my_vcs commit More programming… Sue Jim

Centralised VCS concepts There is one, linear history of changes on the server or repository Each revision has a unique identifier You have a working copy You update the working copy to match the state of the repository You commit your changes to the repository If you someone else has changed it you have to resolve conflicts between your changes and the repository, and then commit

Centralised VCS Server With All Committed Versions Client At v4 Client At v4+ Client At v3

Centralised VCS solo workflow svn checkout vim myfile.py svn commit touch mynewfile.yml svn add mynewfile.yml vim mynewfile.yml svn commit Commands for this in Subversion: Time

Centralised VCS Team workflow: no conflicts Jim’s commands: svn checkout vim jimfile.py svn commit Sue’s commands: svn co svn update cat jimfile.py # Sue can see changes vim suefile.py svn commit

Centralised VCS with conflicts Jim’s commands: svn update vim sharedfile.py svn commit Sue’s commands: svn up vim sharedfile.py svn commit svn: Out of date: ’sharedfile.py’ svn up vim sharedfile.py svn ci

Resolving conflicts On update, you get a prompt like: > svn update Conflict discovered in ’sharedfile.py'. Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: If you choose (e) or (p) the conflicted file will look something like: > cat sharedfile.py previous content <<<<<<<.mine Sue’s content ======= Jim’s content >>>>>>>.r4 Previous content You edit to fix this, then save.

Revisiting history You can update to a particular revision –svn up -r 3 You can see the differences between your working area and a revision –svn diff (to current repository most recent version) –svn diff –r 3 You can see which files you’ve changed or added –svn status You can get rid of changes to a file –svn revert myfile.py

Distributed and Centralized Version Control Centralized: –Some server contains the remote version –Your computer has your copy –To switch back to an old copy you need the internet –E.g. cvs, subversion (svn) Distributed: –Every user has a version of the full history –Users can synchronize their history with each other –Having a central “master” copy is a policy option Most groups do this –E.g. git, mercurial (hg), bazaar (bzr)

Distributed VCS In principle: Master copy (with v0,1,2,4,5) Sue’s copy (with v0,1,2,3) Phil’s copy (with v0,1,2,4,5,6) Jim’s copy (with v0,1,2,4,5) In practice:

Pragmatic distributed VCS Subversion svn checkout svn commit svn up svn status svn diff Git git clone git commit -a git push git pull git status git diff

Why go distributed? Easy to start a repository (no server needed) Easy to start a server Can work without an internet connection Better merges Easy branching More widespread support Why not go distributed? More complex commands Easier to get confused!

Distributed VCS concepts (1) Each revision has a parent that it is based on These revisions form a graph The most recent in each copy is the head or tip Each revision has a globally unique hash-code –E.g. in Sue’s copy revision 43 is ab3578d6 –Jim thinks that is revision 38 When you bring in information from a remote the histories might conflict –Histories from different copies are merged together

Distributed VCS concepts (2) You have a working copy You pick a subset of the files in your working copy to add to the next commit: these go into the staging area or index When you commit, you commit: –from the staging area –to the local repository You push to remote repositories to share or publish your changes You pull or fetch to bring in from a remote

Distributed VCS solo workflow Create a file myfile1.py git init git add. git commit create a new file myfile2.py and edit myfile1.py git add file2.py git commit Only changes to file2 get into commit Edit both files git commit -a Commands for this in Git:

Distributed VCS solo with publishing git clone Edit a few files git add --update git commit git push Edit a few files git commit -a git push Commands for this in Git:

Distributed VCS Team workflow: no conflicts Jim’s commands: git init git add mycode git commit git remote add --track master origin git push git fetch git merge git commit –a git push Sue’s commands: git clone git commit –a git push git pull

Distributed team workflow with conflicts Jim’s commands: git commit -a git push Error: ! [rejected] git pull git commit –a git push Sue’s commands: git commit –a git push git commit –a git push git commit -a git commit –a git pull

Really distributed: more than one remote git remote add sue ssh://sue.ucl.ac.uk/somerepo add a second remote git remote list available remotes git push sue git push origin push to a specific remote

Working with branches

Working with branches in git > git branch * master > git branch experiment > git branch * master experiment > git checkout experiment > git branch master * experiment

Sharing branches in git git push origin experiment publish the branch to remote git push -u origin experiment publish the branch to remote(first time) git branch -r discover branches on remote(s) git checkout origin/experiment get a new branch from a remote

Merging and deleting branches git checkout master switch back to master branch git merge experiment take all the changes from experiment into master exactly like merging someone else’s work git branch -d experiment the experiment is done, get rid of local branch git push --delete experiment git rid of the branch on the remote

Working with branches You should have a development branch and a stable branch You should create temporary branches for experimental changes If you release code to others, you should make a release branch –Then you can make fixes to bugs they find –And control which of your work goes in the release

Tagging You should tag working versions You should produce real science only with specific tagged versions, and note which one

Tagging git tag –a v1.3 add a tag, labelling last commit git tag –a v1.3 ab48dc tag an old commit git push --tags publish the tags to origin

Branching and tagging in subversion You can do branches and tags in subversion too –But it’s harder –svn doesn’t have real branches or tags, instead you make copies of code inside the repo –and you can merge between the copies –It works, but it’s cleaner in git –see subversion references if you need this

More comparisons Subversion svn up –r54 myfile.py svn revert myfile.py svn revert –depth=infinity. Git git checkout –r ab39d myfile.py git checkout myfile.py git reset –hard But git can do more, e.g.: git reset HEAD^ will undo the last commit from your local repository (providing you haven’t pushed) Both git and svn have many options – have a look on the web!

Other version control systems vcs –Really old! –Works by “locking” files instead of resolving conflicts cvs –Very like svn hg –“mercurial” –Very like git

Hosting a server In git, any repository can be a remote for pulls –Just use git pull ssh://theircomputer/theirrepo –There are problems with pushing to someone else’s working repo: don’t! –You can, however, create a git repo with git init --bare –This bare repo has no working directory, –use it as a remote for push and pull via ssh:// In subversion, the procedure is more complicated –You have to configure a server ‘daemon’

Hosting a server in the cloud There are many services which allow you to create git, mercurial, and subversion repositories online –Typically free for open source –Typically a fee for private repositories I recommend GitHub –Create an account at –Students can get five free private repositories at –Can interact with GitHub repositories as either svn or git Bitbucket is also good

Working with GitHub

Set up ssh keys

Create repository

Social coding

Browse changes

Comment on and discuss code

Issue tracking Your code has bugs (defects) Your code has things you want to do (enhancements) The best way to keep track of all this is with an issue tracker

Issue tracking

Anatomy of an issue Type –Defect, enhancement, task Severity –Critical, blocker, major, minor, trivial Owner Status –Open, fixed, duplicate, blocked, under review, won’t fix, invalid, new… Estimated time and time spent? Tags

Timeline of an issue

Some questions Public or private issues Organising issues into milestones Estimate effort? Who can close an issue? Review processes Integration with version control

Some issue trackers Trac Redmine Jira GitHub’s issue tracker Bitbucket’s issue tracker

Issues on GitHub

The Pull Request

Conclusions Tools can make your development easier, safer, more reliable, more correct, and more collaborative They can be complicated and take time to learn Learn by practicing –Use the tools –Pick an open source project on github or bitbucket and start contributing