FEEG Applied Programming 3 - Version Control and Git II

Similar documents
Revision control. INF5750/ Lecture 2 (Part I)

Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

Git & Github Fundamental by Rajesh Kumar.

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Git: Distributed Version Control

Git Introduction CS 400. February 11, 2018

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

Git tutorial. Katie Osterried C2SM. October 22, 2015

A BASIC UNDERSTANDING OF VERSION CONTROL

CESSDA Expert Seminar 13 & 14 September 2016 Prague, Czech Republic

Revision Control and GIT

CS 390 Software Engineering Lecture 5 More Git

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

Version control. what is version control? setting up Git simple command-line usage Git basics

Submitting your Work using GIT

Source Code Management wih git

2 Initialize a git repository on your machine, add a README file, commit and push

Distributed Version Control

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

L Modeling and Simulating Social Systems with MATLAB

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

CS314 Software Engineering Configuration Management

Lecture 6 Remotes. Sign in on the attendance sheet!

Tools for software development:

Git, the magical version control

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

DEVNET Introduction to Git. Ashley Roach Principal Engineer Evangelist

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Object Oriented Programming. Week 1 Part 2 Git and egit

Topics covered. Introduction to Git Git workflows Git key concepts Hands on session Branching models. Git 2

Version Control System - Git. zswu

Introduction to Git and Github

Introduction to Git. Database Systems DataLab, CS, NTHU Spring, 2018

G E T T I N G S TA R T E D W I T H G I T

How to version control like a pro: a roadmap to your reproducible & collaborative research

Version Control Systems

Git: Distributed Version Control

Version Control. Version Control

Version Control with GIT

git Version: 2.0b Merge combines trees, and checks out the result Pull does a fetch, then a merge If you only can remember one command:

Git and GitHub. Dan Wysocki. February 12, Dan Wysocki Git and GitHub February 12, / 48

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

Project 3 Students Choice of Native Apps. each milestone s deadline is noon see cs164.net/expectations for each milestone s expectations

Index. Alias syntax, 31 Author and commit attributes, 334

Software Development I


! #Running this command from the top directory of your project will add all your changes."! $ git add."

Outline The three W s Overview of gits structure Using git Final stuff. Git. A fast distributed revision control system

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

Version Control: Gitting Started

(Cloud9) and to the Remote Repository (GitHub)

Revision Control. How can 4. Slides #4 CMPT 276 Dr. B. Fraser. Local Topology Simplified. Git Basics. Revision Control:

Version control system (VCS)

Tizen/Artik IoT Practice Part 4 Open Source Development

Git. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Managing Network Configurations with Git and GitLab

Software Revision Control for MASS. Git Installation / Configuration / Use

Tips on how to set up a GitHub account:

Version Control. Version Control

Lab Exercise Git: A distributed version control system

Version Control Systems (VCS)

Git. A fast distributed revision control system. Nils Moschüring PhD Student (LMU)

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

MOOSE-Based Application Development on GitLab

Software Engineering

Eugene, Niko, Matt, and Oliver

Assumptions. GIT Commands. OS Commands

GIT. CS 490MT/5555, Spring 2017, Yongjie Zheng

Fundamentals of Git 1

Github/Git Primer. Tyler Hague

Setting up GitHub Version Control with Qt Creator*

Windows. Everywhere else

Lab Objective. Lab Assignment. Downloads and Installation

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

GIT Princípy tvorby softvéru, FMFI UK Jana Kostičová,

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

Tutorial 2 GitHub Tutorial

A L A TEX-oriented intro to Git

Effective Software Development and Version Control

How to be a git. Dominic Mitchell

Version Control System GIT

Version control CSE 403

Improving Your Life With Git

What is Git? What is Git? Version Control. Barry Grant

Version Control with Git ME 461 Fall 2018

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Software Project (Lecture 4): Git & Github

Version control CSE 403

Git. Presenter: Haotao (Eric) Lai Contact:

git and the virtue of version control ECE /2/2015

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Computer Science Design I Version Control with Git

1/20/13 Git tutorial. Git tutorial. Mike Nolta. file:///users/nolta/github/reveal.js/git.html?print-paper#/ 1/31

Introduction to distributed version control with git

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

CSE 332: Data Structures and Parallelism Winter 2019 Setting Up Your CSE 332 Environment

Outline. Version Control System (VCS) basics Git terminology & concepts Basic Git commands Branches in Git Git over the network (time permitting)

1. Git. Robert Snapp

Transcription:

FEEG6002 - Applied Programming 3 - Version Control and Git II Richard Boardman, Sam Sinayoko 2016-10-19

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 2/25

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 3/25

Learning outcomes By the end of this lecture you should be able to: work with multiple copies of a Git repository git clone git pull git push create an account and a public repository for the C labs on Bitbucket to easily work on multiple computers keep your C programs for the labs / coursework under version control 4/25

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 5/25

Working with a single repository Command git init git add git commit -a -m <msg> git log git checkout 5096a git checkout -f 5096a git checkout master git show 5096a git diff 5096a 730a3 master HEAD HEAD^ HEAD~i Description Initialise a version controlled repository Add file(s) to repository (or staging area) Commit all changes (creates new commit) List the commit history Revert the repository to commit 5096a Discard all changes and revert to 5096a Revert to latest commit (= master) Display some info about commit 5096a Display the diff between 5096a and 730a3 Latest commit (default master branch) The current commit Head s parent Head s i th parent 6/25

Original repository contents Change directory to last week s repo and checkout master # cd /path/to/my/repos/feeg6002-git-basics git checkout master # make sure we ve got the latest commit ls # list directory s contents Your branch is up-to-date with 'origin/master'. wise.txt There is only one file, wise.txt, whose content is cat wise.txt - Your programming language is the best one in the world - Your version control system is the best one in the world - Your favourite musician is the best one in the world Alternatively see Appendix A for how to download a copy of the repository from Bitbucket. 7/25

Original repository log file git log commit a4d01345c173363423ad094f276ee2d81dde0adb Author: Rich Boardman <rpb@soton.ac.uk> Date: Tue Aug 23 14:47:54 2016 +0100 Nice guy commit 624dc5830603ed0ffaecc60ce3a3a4c6f79ef35a Author: Rich Boardman <rpb@soton.ac.uk> Date: Tue Aug 23 14:47:19 2016 +0100 Python lover commit 10ed1319928197956330f039082d37134bf9d1ae Author: Rich Boardman <rpb@soton.ac.uk> Date: Tue Aug 23 14:42:52 2016 +0100 Initial commit: MATLAB lover 8/25

Make some more changes and commit Let s add some details to wise.txt: - Your programming language is the best one in the world + helpful community + great syntax Your version control system is the best one in the world + great support + bug-free + efficient transfers - Your favourite musician is the best one in the world git commit -a -m "Add details on language and VCS." [master 689d875] Add details on language and VCS. 1 file changed, 5 insertions(+) 9/25

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 10/25

Cloning a repository (git clone) Motivation Working on the same program on multiple computers: each computer must have a copy, or clone, of the repository. Working on the same program with several people: each person must have a clone of the repository. Making extensive changes that are kept independent of your original repository. Syntax Make a copy of the repository in the current folder "git clone /path/to/original-repo" creates a copy of the entire repository in the current folder, with the same name. "git clone /path/to/original-repo new-repo" renames the repository to "new-repo" 11/25

Cloning a repository (git clone) Go to parent directory of original repository cd.. ls # (go back to parent directory) # (directory contents before cloning) feeg6002-git-basics Clone the repository git clone feeg6002-git-basics feeg6002-angry # (creates new folder feeg6002-angry ) Directory after cloning ls # (feeg6002-angry has appeared) feeg6002-angry feeg6002-git-basics 12/25

(Optional) Change the username in the new repository Let s change the user name to "Mr Hyde". This is just to distinguish him later from the original user "Rich Boardman" in the revision history. You wouldn t normally have to do this, since another user would already have a different name. cd feeg6002-angry git config user.name "Mr Hyde" git config user.email "mrhyde@example.org" 13/25

Make some (angry) changes to the new repository Edit "wise.txt" as follows: - Your programming language is NOT the best one in the world + unhelpful community + terrible syntax - Your version control system is NOT the best one in the world + dreadful support + buggy + hopelessly inefficient transfers - Your favourite musician is awful as well Don t forget to commit: git commit -a -m "Mr Hyde is ANGRY tonight" 14/25

Pulling changes from another repository (git pull) In the original repository we can pull the changes from Mr Hyde: cd../feeg6002-git-basics # go back to original repo git pull../feeg6002-angry # pull the changes into the original repo Updating 689d875..686d75f Fast-forward wise.txt 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Similarly, if "Rich Boardman" commits any new changes to the original repository, "Mr Hyde" can use: git pull to incorporate the commits to this repository. There is a similar command to push commits to a remote repository called git push. 15/25

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 16/25

Dealing with "simultaneous" revisions: merging If there are new commits in both the local repository and the remote one, git pull attempts to merge the two commits. This is only possible if there are not conflicts. If there is a conflict in a file, git puts the two possible versions one after the other and the conflict must be dealt with manually. You should use the command git status to find out whether you have dealt with all the changes. After dealing with all conflicts we can commit again. 17/25

Online repositories (Bitbucket & Github) Git repositories can be hosted for free on Bitbucket http://www.bitbucket.org Repositories can be public or private Private repositories are visible only by people you authorise. Public repositories can be cloned by anyone. Private repositories use the secure protocol SSH which we will cover in a later lecture. For now, keep your repository public. A popular alternative site is GitHub https://github.com, but it does not offer private repositories for free accounts. Just create a new repository on the website and follow the instructions to clone data to it. 18/25

TODO: Create a repository on Bitbucket for the labs Create an account on Bitbucket http://www.bitbucket.org Create a new repository for the labs called feeg6002-labs Use git clone to get a copy of your Bitbucket repository on your local computer. For example create a folder repos to store all your future repositories, change to that directory in the terminal and run # cd /path/to/repos # splitting line over two lines with \ because it s long git clone \ https://richboardman@bitbucket.org/richboardman/feeg6002-labs Cloning into 'feeg6002-labs'... warning: You appear to have cloned an empty repository. Checking connectivity... done. 19/25

TODO: Use your Bitbucket repository in the labs In the labs you can put the repos folder in your Documents folder Put your C programs in that folder and use Git to keep them under version control with: git add git commit -a -m etc. Note: there is need to initialise the repository because Bitbucket does that automatically. Create a folder for each lab in your folder repos/feeg6002-labs and add your programs to it 20/25

TODO: Push your commits to your Bitbucket repository At the end of each session (at home or in the lab), use git push to upload all your commits to Bitbucket git push Password for 'https://richboardman@bitbucket.org': Counting objects: 21, done.... To https://richboardman@bitbucket.org/richboardman/feeg6002-labs * [new branch] master -> master If you use a version of Git older than 2.0, the firs time you do this you ll get an error. Run this command to fix it before pushing again. git config --global push.default simple At the start of each lab using git pull to get an up to date copy of your repository 21/25

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 22/25

Conclusions Summary of the key commands git clone git pull git push create local copy of a repository pull changes from the original repository push changes to the original repository Use Bitbucket to create a public repository online for the labs Clone it locally, add your new programs for each lab, make commits and push your changes. 23/25

Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository Advanced features Conclusions Appendix 24/25

Appendix A: cloning the repository from lecture 2 I have created a public repository containing the repository from lecture 2. You can clone on your local machine by running this command # splitting command over two lines with \ git clone \ https://richboardman@bitbucket.org/richboardman/feeg6002-git-basics This will create a repository in your current folder called feeg6002-git-basics. 25/25