Lecture 5 Remotes Sign in on the attendance sheet! Turn in homework at the front!

Slides:



Advertisements
Similar presentations
Version Control CS440 – Introduction to Software Engineering © 2014 – John Bell Based on slides prepared by Jason Leigh for CS 340 University.
Advertisements

LECTURE 14 OCT 22, 2010 Git, in graphic form. Change tracking basics.
Version Control Systems Phil Pratt-Szeliga Fall 2010.
Hosted Git github. From an alumni (2010)  You know, the more time I spent in industry the better I've understood what a strong advocate you are for the.
Patterns & practices Symposium 2013 Introducing Git version control into your team Mark
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 A distributed version control system 23-Aug-15.
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
Getting Started with GIT. Basic Navigation cd means change directory cd.. moves you up a level cd dir_name moves you to the folder named dir_name A dot.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
A primer on version control at OTN
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Version control Using Git Version control, using Git1.
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
Source Control Primer Patrick Cozzi University of Pennsylvania CIS Spring 2012.
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.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Git Fundamentals Rochelle Terman 13 January 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.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
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.
SECTION 1: CODE REASONING + VERSION CONTROL slides borrowed and adapted from Alex Mariakis and CSE 390a Justin Bare & Deric Pang.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 16 – Version control and git.
Hosted Git github. From an alumnus (2010)  You know, the more time I spent in industry the better I've understood what a strong advocate you are for.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
Lecture 4 Branches Sign in on the attendance sheet!
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. A new git is initialized as a remote repository JohnRemote repositoryPeter master C0 CodingWhileBlack.com PROPEL CODING
Installing git In Linux: sudo apt-get install git In Windows: download it from run the setuphttp://git-scm.com/download/win.
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.
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.
Version Control Systems
CS5220 Advanced Topics in Web Programming Version Control with Git
Information Systems and Network Engineering Laboratory II
Discussion #11 11/21/16.
Git & Github Timothy McRoy.
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
CReSIS Git Tutorial.
Version Control.
Git Practice walkthrough.
Discussion 11 Final Project / Git.
Version Control overview
Git branches and remotes
Macaualy2 Workshop Berkeley 2017
Version Control Systems
Storing, Sending, and Tracking Files Recitation 2
Akshay Narayan git up to speed with RCS Akshay Narayan
Source Code Management
The Big Picture
SIG: Open Week 1: GitHub Tim Choh.
Git CS Fall 2018.
Version control with Git
Introduction to Git and GitHub
GitHub and Git.
GitHub 101 Using Github and Git for Source Control
Git GitHub.
Presentation transcript:

Lecture 5 Remotes Sign in on the attendance sheet! Turn in homework at the front!

Today Fetching Pushing Github

Scenario: Alice, Bob, and Charlie collaborate on a project, but each on their own computer b4e2c29: initial commit AliceBobCharlie 8fc42c6: heapchecker no longer infloops

Scenario: Alice, Bob, and Charlie collaborate on a project, but each on their own computer b4e2c29: initial commit AliceBobCharlie 8fc42c6: heapchecker no longer infloops 6f96cf3: don’t create headers in free blocks 8fc42c6: heapchecker no longer infloops

Scenario: Alice, Bob, and Charlie collaborate on a project, but each on their own computer b4e2c29: initial commit AliceBobCharlie 8fc42c6: heapchecker no longer infloops 6f96cf3: don’t create headers in free blocks 8fc42c6: heapchecker no longer infloops How does Alice get commit 6f96cf3 to Bob and Charlie?

Scenario: Alice, Bob, and Charlie collaborate on a project, but each on their own computer b4e2c29: initial commit AliceBobCharlie 8fc42c6: heapchecker no longer infloops 6f96cf3: don’t create headers in free blocks 8fc42c6: heapchecker no longer infloops How does Alice get commit 6f96cf3 to Bob and Charlie? Idea 1: Bob and Charlie each fetch the commit from Alice. Idea 2: Alice pushes the commit to Bob and Charlie.

Fetching (both Bob and Charlie must do this) Two steps: 1.Tell git to treat Alice’s repository as a “remote repository” or a “remote” and tell git where to find it. This needs to happen only once. 2.Tell git to fetch the commits from the remote repository. Note: if you used `git clone` to get your repository, the url that you cloned from was automatically set as a remote repository.

git remote add Example use: git remote add origin (not my actual IP address) Adds a remote repository called “origin” located at (through SSH) “origin” is the default name for a remote, since often times the first remote you have is the one you clone from

git remote Example use: git remote Lists the names of all your remotes, i.e. origin afs alice

git remote -v Example use: git remote -v Verbosely lists the names of all your remotes, i.e. origin afs alice github

Git Remote URLs 4 choices: HTTPS, SSH, local, git HTTPS: git objects and commits are transferred over web protocols. Pretty easy to set up, unless you need authentication. SSH: git objects and commits are transferred over the SSH protocol. Requires a ssh daemon to be running, allows authentication.

git fetch Example use: git fetch origin Downloads and updates all branches published by the remote. Stores these branches as /. For example, if origin has an updated master branch, then running `git fetch origin` will update your local branch called “origin/master”. These branches like origin/master are called “remote-tracking branches”, because their states should match the origin’s branches’ states. Does NOT affect your own branches, like master!

Example use: git branch -r git branch -a Git branch -r lists all remote-tracking branches. Git branch -a lists all branches, whether local or remote-tracking. git branch -r or git branch -a

How do you actually bring in the remote changes?

How do you actually *merge* in the remote changes?

git merge origin/master

git pull Example use: git pull origin Runs `git fetch `, then `git merge / `. Ex) runs `git fetch origin`, then `git merge origin/master`.

Sometimes pulling is inconvenient In order for people to pull from you, you have to be running a web server or a SSH daemon or something requiring setup, usually. If you’re not collaborating with other people, no one else has your changes and your version control isn’t very distributed.

Pushing is hard too If everyone was allowed to push to you, then people could push random commits to troll you. Even if you kept a whitelist of everyone that was allowed to push to you, it’s rather inconvenient for everything in your working directory to get wiped every time someone pushes. -> With git, you’re not allowed to push to a normal repository. This requires a “bare repository”.

Bare Repositories Created with `git init --bare` Has no working directory, just the contents of what the.git folder would have had Is meant to only be pushed to Fortunately, you rarely have to deal with doing this since Github does all of this behind the scenes for you

Using Github as a remote

git push Example use: git push origin master Updates the remote-tracking branch ( / ) and uploads the necessary commits for that branch to origin You must be fully up-to-date with the remote in order to push! Otherwise your push will be rejected.

What happens if you run `git push`? A. git exception B. git pushes current branch to origin (default remote) C. git pushes all branches to origin (default remote) D. git pushes current branch to all remotes E. git pushes all branches to all remotes F. git pushes to a random remote G. segfault

What happens if you run `git push`? A. git exception B. git pushes current branch to origin (default remote) git2.0 default C. git pushes all branches to origin (default remote) pre-git2.0 default D. git pushes current branch to all remotes E. git pushes all branches to all remotes F. git pushes to a random remote G. segfault

Summary Configuring remotes: git remote [-v] – lists remotes [verbosely] git remote add - configure a new remote git branch –r – lists remote-tracking branches Fetching: git fetch - downloads updates to all remote-tracking branches to match the remote git pull - runs `git fetch`, then merges in updates to the current branch Pushing: git push - uploads changes in your branches to the remote