Akshay Narayan (anarayan@comp.nus.edu.sg) git up to speed with RCS Akshay Narayan (anarayan@comp.nus.edu.sg)

Slides:



Advertisements
Similar presentations
An Introduction By Sonali and Rasika.  Required for the project  Show the versions of your code in the course of development  Show versions of your.
Advertisements

Git Branching What is a branch?. Review: Distributed - Snapshots Files are stored by SHA-1 hash rather than filename Stored in git database in compressed.
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
Introduction to Git and Github Joshua imtraum.com.
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 ▪Version control is a system that records changes to a file or set of files over time so.
Git – versioning and managing your software L. Grewe.
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.
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.
Sofia Event Center May 2014 Martin Kulov Git For TFS Developers.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
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.
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
Jun-Ru Chang Introduction GIT Jun-Ru Chang
Backing up a machine with git
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Dr. Tanusri Bhattacharya
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Introduction to GitHub
M.Sc. Juan Carlos Olivares Rojas
Information Systems and Network Engineering Laboratory II
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
Primož Gabrijelčič Git for Programmers Primož Gabrijelčič
Git and GitHub primer.
11 Version control (part 2)
CReSIS Git Tutorial.
Git-Github Safa Prepared for the course COP4331 – Fall 2016.
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
SSE2034: System Software Experiment 3 Spring 2016
File Version Control System
CS5220 Advanced Topics in Web Programming Version Control with Git
Version Control System using Git
Git branches and remotes
Version Control with Git and GitHub
Macaualy2 Workshop Berkeley 2017
An introduction to version control systems with Git
SU Development Forum Introduction to Git - Save your projects!
Distributed Version Control with git
An introduction to version control systems with Git
Version Control with git
LECTURE 3: Software Configuration Management
The Big Picture
SIG: Open Week 1: GitHub Tim Choh.
An introduction to version control systems with Git
Git-Github Tools Prepared for COP4331. Git-Github Tools Prepared for COP4331.
Version control with Git
Version Control System - Git
Version control with Git
Version Control Software
Version Control with Git
Version Control with Git and GitHub
GitHub 101 Using Github and Git for Source Control
Git Fundamentals.
Version/revision control via git
Git Introduction.
Git GitHub.
Introduction to The Git Version Control System
Presentation transcript:

Akshay Narayan (anarayan@comp.nus.edu.sg) git up to speed with RCS Akshay Narayan (anarayan@comp.nus.edu.sg)

What git? Why git? A distributed version control Allows for non-linear development Why git? A discussion to avoid! Read more here

git concepts Data stored – snapshot of filesystem All data locally available Hence easy to be distributed Data integrity – checksum based git promise – if you commit, I store it safe for you Everything commit is checksummed before stored and hence git knows of every change you make  The hash is calculated based on the contetns of a file or directory structure.

git concepts – 3 states & workflow Modified – files changed Staged – marked modifications for commit Committed – stored in local repository (safe) clone Working directory Staging area Repository (.git directory) .git directory is where all metadata is stored; what get copied when you do a clone Working directory is one version (most likely the latest) of the filesystem uncompressed and placed on the disk to use/modify Checkout to modify Stage edits Commit

Setting up git Create your keys and let the server know of it Setup your identity git uses this in the commits $ git config --global user.name “Akshay Narayan” $ git config --global user.email anarayan@comp.nus.edu.sg Set up the push default git can push all branches or the one you are on now $ git config --global push.default simple

git basics Initializing a repo Clone an existing repo $ git init $ git clone git@github.com:<usr_name>/addressbook-level1.git

git basics Check the status Viewing differences Stage modified files $ git init $ git clone <path/url> git basics Check the status $ git status Viewing differences $ git diff README.md Stage modified files $ git add README.md

git basics Commit changes Rename file Delete a file $ git init $ git clone <path/url> $ git status $ git diff <file> $ git add <file(s)> git basics Commit changes $ git commit $ git commit –m “message” Rename file $ git mv <old> <new> Delete a file $ git rm <file> View commit history $ git log No SourceTree equivalent; Depend on file manager

git intermediate Remotes Show remote Add remote Fetch from remote $ git init $ git clone <path/url> $ git status $ git diff <file> $ git add <file(s)> $ git commit $ git mv <old> <new> $ git rm <file> $ git log git intermediate Remotes Show remote $ git remote -v Add remote $ git remote add <name> <url> E.g. $ git remote add upstream git@github.com:nus.../...ok-level1.git Fetch from remote $ git fetch <remote name> E.g. $ git fetch upstream Push to remote $ git push <remote> <branch> E.g. $ git push upstream master Remove remote $ git remote rm <name>

Branching Diverge from the main development line git Branch Commit tree Commit parents Branch is a pointer! Branches are lightweight Encouraged: Branch often, merge often! Images from: https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell

git most useful! (aka advanced) $ git init $ git clone <path/url> $ git status $ git diff <file> $ git add <file(s)> $ git commit $ git mv <old> <new> $ git rm <file> $ git log $ git remote -v|add|rm $ git fetch <remote> $ git push <rmt> <brnch> git most useful! (aka advanced) Creating branches $ git branch <branch name> $ git checkout -b <branch name> Switching to branch $ git checkout <branch name> HEAD pointer Denotes current branch Switching branches Changes files in the directory Deleting branch $ git branch –d <branch> Notice no -b here

git most useful! (aka advanced) $ git init $ git clone <path/url> $ git status $ git diff <file> $ git add <file(s)> $ git commit $ git mv <old> <new> $ git rm <file> $ git log $ git remote -v|add|rm $ git fetch <remote> $ git push <rmt> <brnch> $ git branch <brnch> $ git checkout git most useful! (aka advanced) Merging Opposite of branching (sort of!) Get back to the branch you want new changes in $ git checkout master Call merge $ git merge myNewBranch Resolve conflicts if any Because the commit C4 pointed to by the branch hotfix you merged in was directly ahead of the commit C2 you’re on, Git simply moves the pointer forward When you try to merge one commit with a commit that can be reached by following the first commit’s history, Git simply moves the pointer forward Calling merge will create a new snapshot that results from the 3 way merge. The pointer to master is moved to the 3 way merged snapshot Git checks and uses the best common ancestor for its merge 3Wmerge: It turns a manual conflict into an automatic resolution. VCS locates the original version of the file.  The VCS then passes the common ancestor and the two contributors to the three-way merge tool that will use all three to calculate the result. Info on 3-way merge: http://www.drdobbs.com/tools/three-way-merging-a-look-under-the-hood/240164902

git most useful! (aka advanced) $ git init $ git clone <path/url> $ git status $ git diff <file> $ git add <file(s)> $ git commit $ git mv <old> <new> $ git rm <file> $ git log $ git commit –amend $ git reset HEAD <file> $ git checkout -- <file> $ git remote -v|add|rm $ git fetch <remote> $ git push <rmt> <brnch> $ git branch <brnch> $ git checkout $ git merge git most useful! (aka advanced) Merge conflict Resolve marked conflicts Add file to staging area $ git add README.md Commit the changes $ git commit

Working with large projects Distributed development E.g. Working on some open source project on Github E.g. Multiple people working on the same project in CS2103 Example workflow: Fork Fork Pull request Main Project Repository Developer 2 Remote Repository Developer 1 Remote Repository Upstream Clone Pull Clone Read only Write Developer 2 Local Repository Developer 1 Local Repository

CS2103 Admin Matters

Project phases Two phases A and B Two different teams Experience

Project expectation Have a target user – specific user One big feature per person – graded Cohesion necessary Eye candies ≠ features Any number of small features – graded differently! No morphing necessary; incremental updates

Every week Some deliverable Incremental Counts for Phase A and Phase B points

Deliverables Individual vs Team Individual ⇒ Team Team = Individual + Something

Tutorials Sign up if you haven’t done (Ideally 16 people) Team formation next week T1 (Thursday 1200-1300)

Doing the right things Doing the things right

Necessary evil! Take care of the admin stuff

Thank you!