Sign in on the attendance sheet!

Slides:



Advertisements
Similar presentations
Git : Part3 Branch Management These slides were largely cut-and-pasted from tutorial/, with some additions.
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.
Introduction to git Alan Orth Nairobi, Kenya September, 2010 version control for serious hackers ;)
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
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
1 Introductory Notes on the Git Source Control Management Ric Holt, 8 Oct 2009.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Prepared by: Steve Teo Contributors: Tong Huu Khiem.
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
2010. The Subversion Dilemma Check in buggy code and drive everyone else crazy Avoid checking it in until it’s fully debugged or.
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.
Git overview for RoboCup Andre Pool, September 2015.
GIT.
12 CVS Mauro Jaskelioff (originally by Gail Hopkins)
Version Control with Git xkcd.com/1597.
Version Control and SVN ECE 297. Why Do We Need Version Control?
Lecture 2 Making Simple Commits Sign in on the attendance sheet! credit:
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
Add New File or a Directory to a Project in the Repository.
Introduction to Git - Chirag Dani. Objectives Basics of Git Understanding different “Mindset of Git” Demo - Git with Visual Studio.
Thanks to our Sponsors! Community Sponsor Yearly Sponsor Marquee Sponsor.
Lecture 4 Branches Sign in on the attendance sheet!
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Lecture 5 Remotes Sign in on the attendance sheet! Turn in homework at the front!
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
Source Control Dr. Scott Schaefer. Version Control Systems Allow for maintenance and archiving of multiple versions of code / other files Designed for.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
CS5220 Advanced Topics in Web Programming Version Control with Git
Introduction to GitHub
Sign in on the attendance sheet!
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
Primož Gabrijelčič Git for Programmers Primož Gabrijelčič
Version Control with Subversion
11 Version control (part 2)
CReSIS Git Tutorial.
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
Setting up Git, GitBash, and GitHub
Source Control Dr. Scott Schaefer.
File Version Control System
Git branches and remotes
ALICE-Juniors Meeting
Software Engineering for Data Scientists
Macaualy2 Workshop Berkeley 2017
Sign in on the attendance sheet!
Akshay Narayan git up to speed with RCS Akshay Narayan
LECTURE 3: Software Configuration Management
SIG: Open Week 1: GitHub Tim Choh.
Setting up Git, GitBash, and GitHub
Advantages Project Career Divide & Conquer Collaboration
EGit in CCS
Version control with Git Part II
Version Control System - Git
Version control with Git
Git started with git: 2018 edition
Git Fundamentals.
Git Introduction.
1. GitHub.
Introduction to The Git Version Control System
Advanced Git for Beginners
Presentation transcript:

Sign in on the attendance sheet! Lecture 5 More on Branches and Merging Sign in on the attendance sheet!

Midterm Next Week During class Very similar to the homework problems Don’t stress! No homework this week, but practice all of the commands we’ve learned.

Last Time Branches are pointers to specific commits Branches allow us to create commit histories that diverge We can merge diverged histories back together wildidea D experiment F master HEAD C B A

git branch <newbranchname> Example use: git branch experiment Creates a new branch called “develop” that points to wherever you are right now (i.e. wherever HEAD is right now) B master HEAD experiment A

git checkout <branchname> Example use: git checkout experiment Switches the HEAD to the branch named “develop” B master HEAD experiment A

Git Log and Branches git log does not show all branches well by itself. Use: git log --graph --decorate --all

git branch Example use: git branch Lists all the local branches in the current repository and marks which branch you’re currently on Where are “you”? Well, you’re always at HEAD. Usually, you’re also at a branch as well. The default branch in a repository is called “master”

Telling if branches are merged git branch --merged Lists all branches merged into the current branch git branch --no-merged Lists all unmerged branches relative to the current branch A branch is merged into the current branch if it is an ancestor of that branch!

Deleting Branches git branch -d <branchname> Will only delete the branch if it is merged into HEAD git branch -D <branchname> Will force delete the branch Deleting a branch just removes the pointer!

Git Diff with Branches E wildidea git diff branch1…branch2 View changes on branch2, starting at the common ancestor of branch1 and branch2. $ git diff master…experiment Shows changes in commits C and D, but not F D experiment F master HEAD C B A

Merging E wildidea D git merge experiment “Will replay the changes made on the experiment branch since it diverged from master (i.e. B) until its current commit (D) on top of master, and record the result in a new commit along with the names of the two parent commits.” (from git help merge) experiment F master HEAD C B A

Fast Forward Merges Occur when the branch being merged onto is an ancestor of the branch being in. No merge commit is made unless --no-ff flag is used Will never cause conflicts! git merge experiment E wildidea D experiment C B master HEAD A

Three-Way Merges E wildidea D experiment Occur when the branch being merged onto is not a descendent of the branch being merged in. The branch being merged onto has “moved on” since the split. Creates a merge commit, can cause conflicts! git merge experiment Performs a “three way merge” between B, F, and D F master HEAD C B A

MERGE CONFLICT master, HEAD G master, HEAD F goodidea D E C B A

MERGE CONFLICT This file is demo.txt <<<<<<< HEAD Here is another line. modified in master ======= Here is another line. modified in goodidea >>>>>>> goodidea

“How to fix a merge conflict” Run `git status` to find the files that are in conflict. For each of these files, look for lines like “<<<<<< HEAD” or “>>>>>> 3de67ca” that indicate a conflict. Edit the lines to match what you want them to be. After you finish doing this for each conflict in each file, `git add` these conflicted files and run `git commit` to complete the merge.

Activity! Create a git repository Make a new file called file1.txt, add some lines to it, and commit it Create two branches called branch1 and branch2 Edit the same line in the text file and make a commit in each branch Switch computers with the person next to you and try to merge both branches back to master (merging the second branch back will require resolving the conflicts). What do we call the merge that occurred when merging the first branch back to master?