Effective Software Development and Version Control

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

Visualizing Git Workflows. A visual guide to 539 workflows

Submitting your Work using GIT

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

Lecture 6 Remotes. Sign in on the attendance sheet!

Version Control with Git

Git Introduction CS 400. February 11, 2018

Windows. Everywhere else

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

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

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

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

CS 320 Introduction to Software Engineering Spring February 06, 2017

Software Development I

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

CSE 391 Lecture 9. Version control with Git

Chapter 5. Version Control: Git

Version control with Git.

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

Git & Github Fundamental by Rajesh Kumar.

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

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

2 Initialize a git repository on your machine, add a README file, commit and push

From Commits to Collaboration: A Git Tutorial for Social Scientists

Intro to Github. Jessica Young

b. Developing multiple versions of a software project in parallel

Version Control. Version Control

DEAD-SIMPLE VERSION CONTROL FOR YOUR TEAM GIT WITH MATTHEW REIDSMA GRAND VALLEY STATE UNIVERSITY

Revision control. INF5750/ Lecture 2 (Part I)

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

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

Git, the magical version control

Version Control: Gitting Started

CSCE UVM Hands-on Session-1 Pre-Work

CS 261 Recitation 1 Compiling C on UNIX

Revision Control and GIT

L Modeling and Simulating Social Systems with MATLAB

Git for Version Control

Introduction to Git and Github Repositories

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:

Git. Presenter: Haotao (Eric) Lai Contact:

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

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

Version Control with GIT

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

Lab Objective. Lab Assignment. Downloads and Installation

Midterm Next Week. Last year s midterm (which didn t include remotes):

Object Oriented Programming. Week 1 Part 2 Git and egit

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

Git Tutorial. André Sailer. ILD Technical Meeting April 24, 2017 CERN-EP-LCD. ILD Technical Meeting, Apr 24, 2017 A. Sailer: Git Tutorial 1/36

Using GitHub for scientific research

Git better. Collaborative project management using Git and GitHub. Matteo Sostero March 13, Sant Anna School of Advanced Studies

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

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

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

Tutorial 2 GitHub Tutorial

AIS Grid School 2015

Tips on how to set up a GitHub account:

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

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

FEEG Applied Programming 3 - Version Control and Git II

Lecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han

Lab 08. Command Line and Git

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

Lecture 6: more pandas (and git/github) LING 1340/2340: Data Science for Linguists Na-Rae Han

A Brief Git Primer for CS 350

How to be a 1337 h4ck3r: Git + Linux

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

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

Improving Your Life With Git

Crash Course in C++ R F L Evans. www-users.york.ac.uk/~rfle500/

Version Control Systems (VCS)

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

How to git with proper etiquette

Lab Exercise Git: A distributed version control system

CS 378: Autonomous Intelligent Robotics (FRI) Dr. Todd Hester

Software Development. Using GIT. Pr. Olivier Gruber. Laboratoire d'informatique de Grenoble Université de Grenoble-Alpes

DEVNET Introduction to Git. Ashley Roach Principal Engineer Evangelist

Versioning with git. Moritz August Git/Bash/Python-Course for MPE. Moritz August Versioning with Git

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

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

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

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

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

Git Tutorial. Version: 0.2. Anders Nilsson April 1, 2014

Version Control with Git ME 461 Fall 2018


Introduction to Git and Github

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

Version Control System GIT

Software Project (Lecture 4): Git & Github

Git: Distributed Version Control

Assumptions. GIT Commands. OS Commands

Programming for Data Science Syllabus

Introduction to the UNIX command line

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

#25. Use Source Control in a Single- Developer Environment

Git for Subversion users

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

Transcription:

Effective Software Development and Version Control Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 5: January 19, 2016 computationforpolicy.github.io

Announcements Do look at the readings Computing takes time outside of class to get comfortable with, it involves trial and error and can be frustrating Homework 1 will get back on Friday Homework 2 out on Thursday Sign up for (and look at) Piazza!

Today What is good code? Collaboratively writing code Version control with git and Github.com

Principles of Good Software Simplicity Clarity Generality Automation

Code Clarity: Comments Comments should add information Unnecessary comment: i += 1 # Add 1 to i Comments should explain why choices were made if not obvious

Code Clarity: Comments Well named variables and functions document themselves num_to_grade = num_assignments * num_students Docstrings Comments at the top of e.g. a function definition that describe the function and its inputs and outputs

Docstring: Example def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero...

Code Clarity: Length Shorter codes are not always better! Better to have slightly longer code that is clearer Avoid unnecessary abstraction

Code Simplicity and Generality Keep it simple: functions should ideally do only one thing Avoid repetition in code The more complex the code, the more likely bugs will be introduced

Catching Errors, Bugs and Testing Make programs more robust by validating inputs (and providing useful feedback) if type(my_var)!= int : print( Warning: Unexpected type for my_var )

Version Control alice Version 1 Version 2

Collaboration alice bob

Git Version Control System

Git Version Control System https://xkcd.com/1597/

Git Repository repo for short Each project you work on will have a git repository Can store many types of data in a repository: Code Images Folders Text data Can use version control software for many applications e.g. writing papers, presentations, collaboratively doing data analysis, etc. Used primarily for coding

Git GUI https://git-scm.com/downloads/guis

Github.com

Github.com Git repositories can be hosted on Github.com Can sync everything with Github.com Used by many open source software projects to collaboratively develop software

Using git locally Local Repository git commit Staging git add Working directory git commit is a set of changes

Basic Git Commands https://try.github.io/levels/1/challenges/1

Make new repository mkdir examplerepo cd examplerepo git init tutorial started here # make new folder for my new project # go to that directory # initialize a git repo here

git status See what the current status of your working directory is

git log See the commit history of your project

git add Tell git to start tracking them git add myfile.txt Tell git to stage some files for the next commit

git rm Tell git to stop tracking some files git rm myfile.txt

git reset Unstage a file git reset myfile.txt

git commit Commit changes to the current branch git commit -m My descriptive commit message

That s everything you need for using git for version control on your local machine.

Review Edit files with your text editor: nano, vi, emacs, Sublime text, etc. Stage changes: git add filename Check changes: git status Commit changes: git commit -m Message here

Important Almost nothing is ever deleted because the entire history is stored Can revert to any point in the history

Remote (Github) Repository Using Github git push Local Repository git pull git commit Staging git add Working directory

Using Github Collaboratively Bob: local repository Github repository Alice: local repository

Branches

Connecting local repos with Github: Two options 1. Initialize repo locally, then create empty repo on Github and push local repo to Github: git remote add origin https://github.com/username/reponame.git 2. Initialize repo on Github, clone (copy) to local machine: git clone https://github.com/username/username.git

git push Push our local commits to our remote repository on Github git push -u origin master name of remote repo branch name

git pull Pull down any changes that have been made: git pull origin master name of remote repo branch name

.gitignore Tell git to never track certain files by putting them into. gitignore: mysecretfile *.pyc Files on Unix-based operating systems that begin with. are hidden files and can be shown by ls -a

Important Every copy of the repo is a backup of the entire history Only need network for pulling and pushing

Using Branches

Branches 1. 2. 3. 4. Make new branch: git branch feature Switch to new branch: git checkout feature Make some commits: git commit... Merge in feature branch: git checkout master git merge feature 5. Push everything to Github: git push

Pull request Used instead of pushing directly to master Make some changes, e.g. add a new feature, in a branch and submit a pull request Maintainer reviews changes Discussion and further commits may occur When maintainer is happy with the new code, she accepts the pull request

Git nomenclature HEAD: Refers (points) to the current branch origin: Refers to the remote repo (Github)

https://github.com/pydata/pandas Pandas

Track bugs and feature requests Especially useful for collaboration https://github.com/pydata/pandas/issues Issues

https://github.com/pydata/pandas/pulls Pull Requests

For Assignment 2: You will... Sign up for a student developer account on Github Make a private git repository on Github.com Add myself, Eric, and Bill as collaborators Use git to work on your homework

https://education.github.com/pack

Setting up git on your local machine Installed on the VM Instructions for getting your account set up with your machine: https://help.github.com/articles/set-up-git/

Commands to know git init git checkout git clone git merge git add git push git status git fetch git commit git pull git branch git log

Resources General programming advice: The Practice of Programming by Kernighan and Pike Python style: https://www.python.org/dev/peps/pep-0008/ http://docs.python-guide.org/en/latest/writing/style/ Introduction to Github: https://guides.github.com/activities/hello-world/ Introduction to git: https://try.github.io/levels/1/challenges/1

Resources General programming advice: The Practice of Programming by Kernighan and Pike Python style: https://www.python.org/dev/peps/pep-0008/ http://docs.python-guide.org/en/latest/writing/style/ Introduction to Github: https://guides.github.com/activities/hello-world/ Introduction to git: https://try.github.io/levels/1/challenges/1