Sign in on the attendance sheet!

Slides:



Advertisements
Similar presentations
om om GIT - Tips & Tricks / git.dvcs git-tips.com
Advertisements

Introduction to git Alan Orth Nairobi, Kenya September, 2010 version control for serious hackers ;)
Git A distributed version control system 23-Aug-15.
1 Web Design Workshop DIG 4104c Spring 2014 Dr. J. Michael Moshell University of Central Florida Lecture 2: The git source control system
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 Intro Information mostly from Pro Git. Prepare  Start Eclipse, we have a 5-minute exercise later.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git: Part 1 Overview & Object Model These slides were largely cut-and-pasted from tutorial/, with some additions.
Distributed Version Control. Image stolen from which is really good, go read it.  Old-school version control.
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.
Git. What’s Git? A British swear A Distributed Version Control System Developed in 2005 by Linus Torvalds for use on the Linux Kernel Git Logo by Jason.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Peter Ogden and Josh Levine.  Motivation  High level overview  Walk through the common operations  How not to break things (too badly)
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
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
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Git Basics. Git stores data as snapshots of the project over time When commit Save all the files If files have not changed, point to the previous identical.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
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.
GIT: What, how and why ? Part 1: Basics. What do I know about git? Started using it for experiments on April 2009 Moved all voms development on git on.
INTRODUCTION TO GIT. Install Egit for eclipse Open eclipse->Help->Install New Software Search for one of the following -
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.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
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
Git for bzr users October Aurélien Gâteau An attempt at making you comfortable when you have to work with a git repository.
Backing up a machine with git
Introduction to Git and git-svn Paul Gier Red Hat Sept. 27, 2011.
Basics of GIT for developers and system administrators
M.Sc. Juan Carlos Olivares Rojas
L – Modeling and Simulating Social Systems with MATLAB
Primož Gabrijelčič Git for Programmers Primož Gabrijelčič
CReSIS Git Tutorial.
Git-Github Safa Prepared for the course COP4331 – Fall 2016.
LECTURE 2: Software Configuration Management
Git Practice walkthrough.
Setting up Git, GitBash, and GitHub
L – Modeling and Simulating Social Systems with MATLAB
SSE2034: System Software Experiment 3 Spring 2016
Sign in on the attendance sheet!
File Version Control System
An introduction to version control systems with Git
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
An introduction to version control systems with Git
LECTURE 3: Software Configuration Management
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 Part II
Version Control System - Git
Version control with Git
Introduction to Git and GitHub
Convert an Eclipse Project to a Git repository and push up to GitHub
Git started with git: 2018 edition
Қазақ Ұлттық Техникалық Зерттеу Университеті
Version Control with Git and GitHub
Introduction to Git and Github
Git GitHub.
Introduction to The Git Version Control System
Presentation transcript:

Sign in on the attendance sheet! Lecture 3 More on Git Commits Sign in on the attendance sheet!

Review: The Git Commit Workflow (Edit, Add, Commit) file1.txt (v2) file2.txt (v1) file3.txt (v2) 1. Make changes to files vim file1.txt file3.txt Working Directory file1.txt (v2) file2.txt (v1) file3.txt (v1) 2. Add changes to the staging area git add file1.txt Staging Area file1.txt (v2) file2.txt (v1) file3.txt (v1) 3. Commit changes in staging area git commit -m “fixed bug in file1.txt” List of commits bb2df1a (HEAD) git add file1.txt file1.txt (v1) file2.txt (v1) file3.txt (v1) 782cb4f file1.txt (v1) file2.txt (v1) ab628cc

No difference from an edit, use git add newfile.txt. What about new files? newfile.txt (v1) file1.txt (v1) file2.txt (v1) Working Directory newfile.txt (v1) file1.txt (v1) file2.txt (v1) Staging Area newfile.txt (v1) file1.txt (v1) file2.txt (v1) List of commits bb2df1a (HEAD) git add newfile.txt file1.txt (v1) file2.txt (v1) 782cb4f file1.txt (v1) ab628cc No difference from an edit, use git add newfile.txt.

What about removing files? newfile.txt (v1) file1.txt (v1) file2.txt (v1) Working Directory ___ file1.txt (v1) file2.txt (v1) Staging Area file1.txt (v1) file2.txt (v1) List of commits bb2df1a (HEAD) git rm newfile.txt newfile.txt (v1) file1.txt (v1) file2.txt (v1) 782cb4f file1.txt (v1) ab628cc git rm newfile.txt (also deletes newfile.txt from working directory!)

What about renaming files? newfile.txt (v1) file1.txt (v1) file2.txt (v1) Working Directory betterfile.txt (v1) file1.txt (v1) file2.txt (v1) Staging Area betterfile.txt (v1) file1.txt (v1) file2.txt (v1) List of commits bb2df1a (HEAD) git mv newfile.txt betterfile.txt newfile.txt (v1) file1.txt (v1) file2.txt (v1) 782cb4f file1.txt (v1) ab628cc git mv newfile.txt betterfile.txt

What if I want to ‘unstage’ a file? coolfile.txt (v2) file1.txt (v1) file2.txt (v1) Working Directory coolfile.txt (v2) coolfile.txt (v1) file1.txt (v1) file2.txt (v1) Staging Area coolfile.txt (v1) file1.txt (v1) file2.txt (v1) List of commits git reset HEAD coolfile.txt bb2df1a (HEAD) newfile.txt (v1) file1.txt (v1) file2.txt (v1) 782cb4f file1.txt (v1) ab628cc git reset HEAD coolfile.txt (Note WD is unaffected)

What if I want to start over on a file (in the WD)? coolfile.txt (v2) coolfile.txt (v1) file1.txt (v1) file2.txt (v1) Working Directory coolfile.txt (v2) coolfile.txt (v1) file1.txt (v1) file2.txt (v1) Staging Area coolfile.txt (v1) file1.txt (v1) file2.txt (v1) List of commits git checkout HEAD coolfile.txt bb2df1a (HEAD) newfile.txt (v1) file1.txt (v1) file2.txt (v1) 782cb4f file1.txt (v1) ab628cc git checkout HEAD coolfile.txt

What if I want to start over (in both WD and SA)? coolfile.txt (v2) coolfile.txt (v1) file1.txt (v2) file1.txt (v1) file2.txt (v1) Working Directory coolfile.txt (v2) coolfile.txt (v1) file1.txt (v2) file1.txt (v1) file2.txt (v1) Staging Area coolfile.txt (v1) file1.txt (v1) file2.txt (v1) List of commits bb2df1a (HEAD) git reset --hard HEAD newfile.txt (v1) file1.txt (v1) file2.txt (v1) 782cb4f file1.txt (v1) ab628cc git reset --hard HEAD (overwrites entire WD!)

Summary: Manipulating the Staging Area To update the staging area with files from your working directory, use “git add”. To update the staging area with files from HEAD, use “git reset”. To delete files from the staging area, use “git rm”. That’s how you manipulate the staging area. How about the working directory?

Summary: Manipulating the Working Directory To update files in the working directory, edit files with vim or your preferred text editor. To reset files in the working directory to how they were in a particular commit, use “git checkout”. If you want to reset the staging area at the same time (which is often the case), use “git reset --hard” (but with caution).

Ignoring files *.log logs Build *.jar By default Git tracks everything in your repository Not always a good thing – log files, compiled files, cache files, etc. Tell git to ignore these files using a .gitignore file https://github.com/github/gitignore for examples *.log logs Build *.jar .gitignore “*” means anything, so any file that ends with .log Standalone words are (usually) folders, so anything in logs/ or Build/ is ignored

Configuring Git Git has certain settings by default Provide Git with your name, email Customize Git to take advantage of its features, integration with other tools, different settings with special powers, etc. git config --global user.name "John Doe" git config --global user.email johndoe@example.com

Where we are This wraps up our discussion of “how to make commits”. So far, our commits were made in a very linear fashion – every commit had exactly one parent, and had a maximum of one child. In larger projects, this probably won’t happen – the commits will begin branching off each other. Next week: branches

Activity Groups of two or three One person create a new Git repository using “git init” in a new folder Add some files and make some commits, write down your steps if you won’t remember Ask the other person to try to work backwards and figure out a possible set of steps that brought the repository to this state Switch places and do this one more time