G E T T I N G S TA R T E D W I T H G I T

Similar documents
Software Development I

Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

Github/Git Primer. Tyler Hague

Submitting your Work using GIT

GIT. CS 490MT/5555, Spring 2017, Yongjie Zheng

Introduction to Git. Database Systems DataLab, CS, NTHU Spring, 2018

Software Revision Control for MASS. Git Installation / Configuration / Use

Git. Presenter: Haotao (Eric) Lai Contact:

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Tips on how to set up a GitHub account:

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

A BASIC UNDERSTANDING OF VERSION CONTROL

Version Control. Collaborating with git. Tim Frasier

Lab 08. Command Line and Git

Human-Computer Interaction Design

API RI. Application Programming Interface Reference Implementation. Policies and Procedures Discussion

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Using GitHub to Share with SparkFun a

Intro to Github. Jessica Young

Setting up GitHub Version Control with Qt Creator*

Version Control. Version Control

The Old World. Have you ever had to collaborate on a project by

Git tutorial. Katie Osterried C2SM. October 22, 2015

About SJTUG. SJTU *nix User Group SJTU Joyful Techie User Group

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

Overview. 1. Install git and create a Github account 2. What is git? 3. How does git work? 4. What is GitHub? 5. Quick example using git and GitHub

Assumptions. GIT Commands. OS Commands

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

FEEG Applied Programming 3 - Version Control and Git II

A Brief Introduction to Git. Sylverie Herbert (based on slides by Hautahi Kingi)

Tizen/Artik IoT Practice Part 4 Open Source Development

Human-Computer Interaction Design

Tutorial 2 GitHub Tutorial

Git & Github Fundamental by Rajesh Kumar.

1. Git. Robert Snapp

Git Introduction CS 400. February 11, 2018

Version Control: Gitting Started

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

Outline The three W s Overview of gits structure Using git Final stuff. Git. A fast distributed revision control system

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

Version control with Git.

GUIDE TO MAKE A REAL CONTRIBUTION TO AN OPEN SOURCE PROJECT 1. 1

Chapter 5. Version Control: Git

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Computer Science Design I Version Control with Git

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

CS 390 Software Engineering Lecture 5 More Git

git Version: 2.0b Merge combines trees, and checks out the result Pull does a fetch, then a merge If you only can remember one command:

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

Version control with git and Rstudio. Remko Duursma

Version Control. Version Control

(Cloud9) and to the Remote Repository (GitHub)

Intermediate Programming, Spring Misha Kazhdan

Git. A fast distributed revision control system. Nils Moschüring PhD Student (LMU)

Tutorial: Getting Started with Git. Introduction to version control Benefits of using Git Basic commands Workflow

Revision control. INF5750/ Lecture 2 (Part I)

Version Control Systems

Git(Lab) Tutorial and Hands-On

A Brief Git Primer for CS 350

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Gerrit

Revision Control. How can 4. Slides #4 CMPT 276 Dr. B. Fraser. Local Topology Simplified. Git Basics. Revision Control:

Version Control System - Git. zswu

MOOSE-Based Application Development on GitLab

699DR git/github Tutorial


Git and GitHub. Dan Wysocki. February 12, Dan Wysocki Git and GitHub February 12, / 48

License. Introduction to Version Control with Git. Local Version Control Systems. Why Use Version Control?

Introduction to Git and Github

Visualizing Git Workflows. A visual guide to 539 workflows

Improving Your Life With Git

How to version control like a pro: a roadmap to your reproducible & collaborative research

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

CSE 391 Lecture 9. Version control with Git

Using GitHub and SourceTree to work with DITA TC repositories

Introduction to Version Control with Git

Version Control with Git ME 461 Fall 2018

Git Setup Help using GitKraken (CSE 154)

L Modeling and Simulating Social Systems with MATLAB

Version Control. Software Carpentry Github s Hello World Git For Ages 4 And Up You need source code control now

History...: Displays a window of Gitk, a standard commit viewer for Git.

Git: Distributed Version Control

What is Git? What is Git? Version Control. Barry Grant

CS314 Software Engineering Configuration Management

Git for Version Control

KTH Royal Institute of Technology SEMINAR 2-29 March Simone Stefani -

Eugene, Niko, Matt, and Oliver

Git: Distributed Version Control

Pragmatic Guide to Git

GIT Princípy tvorby softvéru, FMFI UK Jana Kostičová,

Windows. Everywhere else

Git. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Git AN INTRODUCTION. Introduction to Git as a version control system: concepts, main features and practical aspects.

Revision Control. An Introduction Using Git 1/15

Effective Software Development and Version Control

Outline. Version Control System (VCS) basics Git terminology & concepts Basic Git commands Branches in Git Git over the network (time permitting)

A L A TEX-oriented intro to Git

1/20/13 Git tutorial. Git tutorial. Mike Nolta. file:///users/nolta/github/reveal.js/git.html?print-paper#/ 1/31

Table of Contents. Concepts

Transcription:

G E T T I N G S TA R T E D W I T H G I T A A R O N H O O V E R & B R A D M I N C H J A N U A R Y 2 2, 2 0 1 8 1 Why use a version control system? Much of this document was blatantly cribbed from Allen Downey s fork of the book Pro Git called Am Git. In this class you will be working in teams. For the miniprojects, they may be small teams of two, and for the final project, they may be teams as large as five. You will also be writing a lot of code - C code for the PIC microcontroller and Python (or a language of your choice) on your laptops. If you ve ever tried to manage collaborative work on a project using tools like Dropbox, folders on Public, or email + attachments, then you know what a headache it can be to keep track of files, share revisions, and generally ensure that things don t get mucked up. A version control system provides the following features and advantages that make it helpful in these situations: The history of files is tracked and readily viewed so that you can know who edited what when. It is possible to revert a file to an older version in the event that change causes problems. Files are typically stored both locally and remotely in a repository on a professionally maintained server, protecting against catastrophic loss of data. Copying and sharing a repository is easy, making collaboration easy. The repository can help people on a team coordinate their work. Some version control systems include tools with added functionality like the ability to track and assign issues. 2 Installing Git Git is the name of the version control system we will use in this class. Github is a website that hosts remote Git repositories and provides different interfaces and tools for those repositories. Windows There are a few options for using git on Windows. Probably the easiest to help you get up and running is GitHub Windows available at http://windows.github.com. GitHub Windows includes a simple GUI as well a command line tool (that uses PowerShell by default) for using the git commands.

getting started with git 2 Mac It is probably easiest to install git on OSX from a terminal using Homebrew by running >brew install git You can install homebrew by following the instructions at http://brew.sh/. 3 First Time Setup Identity - You will need to configure Git with your username and email address because these pieces of information are appended to all of your commits. The first time you open GitHub windows, it prompts you for this information, otherwise you can enter it manually from the command line as follows: >git config --global user.name "Aaron Hoover" >git config --global user.email "aaron.hoover@olin.edu" Editor - Many a flame war has erupted over which text editor is the best for writing code. We will not fuel the fire here. However, sometimes Git has occasion to open a text editor (to add comments to a commit, for example). To get it to automatically open your favorite editor you can execute the following from the command line: >git config --global core.editor my_favorite_editor Check Your Settings - You can inspect your current Git settings with the following: >git config --list Getting Help - From time to time, you may need to be reminded of what Git commands do or even what they are. You can use any of the following: >git help git >git help <verb> For example, >git help push will show you the manual page for the push command. 4 Create a Github Account Go to Github and sign up for an account.

getting started with git 3 5 Forking and Cloning a Repository 5.1 Forking We have set up a repository for the class on Github. The first operation you need to perform is to fork this repository. This will create a copy of the repository that you own under your Github user account. Any changes you make to the code and commit will show up in your copy of the repository, not in the one that belongs to the OlinElecanisms organization. To fork the repository, navigate to the URL and click the Fork button in the upper right-hand corner of the page. 5.2 Cloning Now, you will need to clone the repository to a location on your local file system. Cloning creates a local repository on your machine. You can clone within GitHub Windows by clicking on the little + sign in the upper left and selecting the Clone option on the resulting screen. To clone the repository from the command line, change to the directory where you d like to store the code and execute: >git clone https://github.com/<your username>/elecanisms You may name the repository something other than elecanisms by appending an optional argument to the end of the git clone command. 6 Editing, committing, and pushing changes 6.1 Editing Open the blink subdirectory and open the file blink.c in the editor of your choice. Edit and save the file. In GitHub Windows, you ll notice a heading appears that says Uncommitted changes, meaning you have made changes that are not yet committed to your repository. Expanding the heading shows all the files with changes and highlights the changes for you. You can also check for uncommitted changes from the command line: >git status The output should look something like this: On branch master

getting started with git 4 Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: blink.c no changes added to commit (use "git add" and/or "git commit -a") 6.2 Committing Before you can commit them to the repository, you need to add your changes to the commit. In the GUI, this is accomplished simply by checking the checkbox next to the name of each file whose changes belong in the commit. To do it using the command line (with blink.c) we execute: >git add blink.c Now, running git status displays: On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: blink.c To actually commit from the GUI, we need to enter a description of the changes in the Summary text box at the top of the Uncommitted changes area. Once a summary has been entered, a button with a check mark on it next to the text, Commit to master is enabled. Clicking that button commits the changes to our local respository From the command line, we can run: >git commit -m Sample commit message Your commit messages should be concise and informative so that the changes made as part of a commit are apparent immediately to anyone reading the message. 6.3 Pushing We are almost finished. We have committed the changes to our local repository, but we still need to update the repository stored on Github because this is the repository that is shared by our teammates.

getting started with git 5 In the GUI, simply click the Sync icon in the upper right corner of the application. To do that from the command line, run: >git push origin master The push command takes a destination and a source as its two arguments. origin refers to the remote repository from which the local repository was cloned. master is the name of the branch we committed our changes to. We haven t discussed branches yet, but in our case we have only one branch which, by default, is called master. 7 Typical Workflow The most typical workflow after you have cloned a repository is shown below. 7.1 GUI 1. Click the Sync button to get all the latest changes from the remote repository since your last sync. 2. Modify files as needed. 3. Show uncommitted files and select the changed files you intend to commit. 4. Enter a commit message in the Summary field. 5. Click Commit to master to commit to your local repository. 6. Click Sync to push your local changes to the remote repository. 7.2 Command line 1. git pull: Gets changes made to the remote repository since your last push 2. Modify some files 3. git add <files>: Stages changes to be committed 4. git commit: Commits changes to the local repository 5. git push origin master: Copies committed changes to the remote repository