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

Simple Git Steve Pieper. Topics Git considerations and Slicer Git as if it were svn Git the way it is meant to be.
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.
Introduction to Git 2011 F2E Summit Jenny Donnelly, YUI.
CSE 326: Data Structures Splay Trees Ben Lerner Summer 2007.
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.
Git
Branching. Version Control - Branching A way to write code without affecting the rest of your team Merge branches to integrate your changes.
…using Git/Tortoise Git
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Paul McGrath.  Speedy Input  Speedy Visualisation  Speedy Workflow.
Dealing with Conflicting Updates in Git CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.6 © Mitchell Wand, This work is licensed under a.
1 © 2015 Albion College | BUGMI 2015 Git’s Architecture And How It Relates to Banner Eddie Bachle Albion College September 25, 2015.
Version Control with Git xkcd.com/1597.
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.
Thanks to our Sponsors! Community Sponsor Yearly Sponsor Marquee Sponsor.
Lecture 4 Branches Sign in on the attendance sheet!
Lecture 5 Remotes Sign in on the attendance sheet! Turn in homework at the front!
Git And Social Coding Chris
Getting Started with Git Presented by Jim Taylor Rooty Hollow, Owner Verizon Wireless, Senior Programmer/Analyst Git User for 6 years.
Collaborative Git An introduction to Git with others
GIT Version control. Version Control Sharing code via a centralized DB Also provides for Backtracking (going back to a previous version of code), Branching.
GIT: (a)Gentle InTroduction Bruno Bossola. Agenda About version control Concepts Working locally Remote operations Enterprise adoption Q&A.
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Information Systems and Network Engineering Laboratory II
I don’t git it! Source control management deep dive with tfvc and git
11 Version control (part 2)
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
GitHub workflow according to Google
Sign in on the attendance sheet!
A Simple Introduction to Git: a distributed version-control system
CS5220 Advanced Topics in Web Programming Version Control with Git
Git branches and remotes
Software Engineering for Data Scientists
B+-Trees.
Macaualy2 Workshop Berkeley 2017
Sign in on the attendance sheet!
Concurrent Version Control
Artificial Intelligence Lecture No. 5
Let’s start with some questions:
Distributed Version Control with git
Transition from Classic Interface Phoenix Interface to
Akshay Narayan git up to speed with RCS Akshay Narayan
LECTURE 3: Software Configuration Management
The Big Picture
CS122B: Projects in Databases and Web Applications Winter 2018
Tips on Homework 2 Fei Chen.
Evolution Notes.
Advantages Project Career Divide & Conquer Collaboration
Hash Tables Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common.
Git CS Fall 2018.
Version Control System - Git
Database Systems (資料庫系統)
Git started with git: 2018 edition
Version Control with Git
Hash Tables Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common.
Git Fundamentals.
Identifying & Creating Use Cases - Part 3
Git Introduction.
Branches And Releases Branch for Urgent Bug Branch for Feature A
Their own physical condition. The first guy had leprosy. Vs
1. GitHub.
Presentation transcript:

Sign in on the attendance sheet! Lecture 7 Rebasing Sign in on the attendance sheet!

Today Review of merging Rebasing instead of merging Interactive rebases

Review: Merging To combine two branches, with a merge, we do something like git merge branch B to bring all of branch B’s changes into master via a merge commit (the commit is necessary to record the changes being brought in, especially if there are conflicts). branchA, HEAD branchB E F C D B A

Review: Merging To combine two branches, with a merge, we do something like git merge branch B to bring all of branch B’s changes into master via a merge commit (the commit is necessary to record the changes being brought in, especially if there are conflicts). branchA, HEAD G branchB E F This is kinda ugly to have in our git history, especially if the two branches being combined make very similar changes. Wouldn’t it be nice to combine branches in a linear fashion? C D B A

Review: Merging branchA, HEAD E C branchA, HEAD branchB branchB E F F This is kinda ugly to have in our git history, especially if the two branches being combined make very similar changes. Wouldn’t it be nice to combine branches in a linear fashion? D C D B B A A

Review: Merging branchA, HEAD E C branchA, HEAD branchB branchB E F F This is kinda ugly to have in our git history, especially if the two branches being combined make very similar changes. Wouldn’t it be nice to combine branches in a linear fashion? Enter git rebase. D C D B B A A

git rebase <branch-to-rebase-onto> Example use: git rebase master Finds the common ancestor of the given branch and the current branch, then “replays” the changes of all commits of the current branch up to the ancestor onto the given branch.

Rebasing (assume we’re on branchA) git rebase branchB Find the common ancestor. Replay the changes of all commits up to the ancestor on top of the given branch. Move the branch to the new top. branchA, HEAD E C branchA, HEAD branchB branchB E F F D C D B B Key idea: git rebase combines two branches while ensuring that the history looks linear. A A

Another rebasing problem (adapted from midterm) What happens if I do the following? (on master) git rebase experiment master B A C D F develop experiment base

Another rebasing problem (adapted from midterm) What happens if I do the following? (on base) git rebase experiment master B A C D F develop experiment base

Another rebasing problem (adapted from midterm) What happens if I do the following? (on experiment) git rebase base master B A C D F develop experiment base

Another rebasing problem (adapted from midterm) What happens if I do the following? (on master) git rebase develop master B A C D F develop experiment base

Git rebasing does not delete commits When you rebase, you create new commits, and your branch moves to the new commits you’ve made. The old commit history still exists, it’s just inaccessible now that the branch has moved. If you really want to, you can checkout to those commits if you know the hash.

Git rebasing does not delete commits branchA, HEAD C branchA, HEAD branchB branchB E F E F C D C D B B A A

Merge vs Rebase Both are ways of combining changes from two different branches. Generally, I prefer merges for combining branches that are distinct in their purpose (feature branches, branches for different parts of a project) and rebases for branches that are really similar (i.e. two people working on the same part of a project but create a conflict).

Interactive Rebase Normal rebase only allows you to “replay” changes of commits onto another branch. Interactive rebase gives you a lot more power on how this “replay” happens.

git rebase –i <branch-to-rebase-onto> Example use: git rebase –i master Finds the common ancestor of the given branch and the current branch, then “replays” changes of all commits of the current branch up to the ancestor onto the given branch, but opens an editor for you to specify how the “replay” occurs.

Rebase Options

Git rebasing, but in reverse order How do I do this? We need to apply D, then B… master, HEAD B A C D F develop experiment master, HEAD B A C D F develop experiment base base

Git rebasing, but deleting commits How do I do this? We need to apply D, but not B… master, HEAD B A C D F develop experiment A C D F develop experiment master, HEAD base base

Git rebasing, but squashing commits How do I do this? We need to apply B, but apply D in the same commit… master, HEAD B A C D F develop experiment master, HEAD A C D, B F develop experiment base base

Summary Git rebase allows you to combine branches, but maintain a linear history. Git rebase –i (interactive rebase) allows you to control precisely how commits in a linear history take place, including deleting history! Rebasing works by reapplying unshared commits onto the given branch and moving your branch there.