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

Similar documents
Getting started with GitHub

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

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

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

Topics covered. Introduction to Git Git workflows Git key concepts Hands on session Branching models. Git 2

Version Control: Gitting Started

Git. Ľubomír Prda. IT4Innovations.

Git for Newbies. ComMouse Dongyue Studio

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

Git. Presenter: Haotao (Eric) Lai Contact:

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

Github/Git Primer. Tyler Hague

Git Introduction CS 400. February 11, 2018

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

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

Intro to Github. Jessica Young

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

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

Version Control System - Git. zswu

E, F. deleteall command, 352 directory structure, 350 export_data method, 353 inline_data method, 353 print_export method, 351 target directory, 351

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

Git for Subversion users

Git Basi, workflow e concetti avanzati (pt2)

Version Control Systems (VCS)


CESSDA Expert Seminar 13 & 14 September 2016 Prague, Czech Republic

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

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

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

Revision control. INF5750/ Lecture 2 (Part I)

Revision Control and GIT

Submitting your Work using GIT

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Git version control with Eclipse (EGit) Tutorial

Software Project (Lecture 4): Git & Github

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:

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

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

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

Version Control for Fun and Profit

Git Setup Help using GitKraken (CSE 154)

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

Version Control with GIT: an introduction

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

Version Control Systems: Overview

Git. A Distributed Version Control System. Carlos García Campos

Version Control with GIT

An Introduction to Subversion

Introduction, Instructions and Conventions

Introduction to distributed version control with git

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

git-pr Release dev2+ng5b0396a

Version control with Git.

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

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

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

Git tutorial. Katie Osterried C2SM. October 22, 2015

Software Development I

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

Computer Science Design I Version Control with Git

Software Revision Control for MASS. Git Basics, Best Practices

Version Control with Git ME 461 Fall 2018

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

FEEG Applied Programming 3 - Version Control and Git II

CSE 391 Lecture 9. Version control with Git

Version Control Systems (Part 1)

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

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

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

Git, the magical version control

Windows. Everywhere else

Continuous integration & continuous delivery. COSC345 Software Engineering

Git! Fundamentals. IT Pro Roundtable! June 17, 2014!! Justin Elliott! ITS / TLT! Classroom and Lab Computing!! Michael Potter!

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Fundamentals of Git 1

CS 390 Software Engineering Lecture 5 More Git

Push up your code next generation version control with (E)Git

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

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

How to be a git. Dominic Mitchell

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

Index. Alias syntax, 31 Author and commit attributes, 334

Reproducibility with git and rmarkdown

Git for Version Control

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

Code Repository. P Blanchfield

Visualizing Git Workflows. A visual guide to 539 workflows

Using git to download and update BOUT++

Using Git For Development. Shantanu Pavgi, UAB IT Research Computing

Version Control. So#ware Quality Quality Audit and Cer2fica2on. Master in Computer Engineering. Roberto García

Git(Lab) Tutorial and Hands-On

Having Fun with Social Coding. Sean Handley. February 25, 2010

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

Programming with Haiku

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

Git GitHub & secrets

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

Git: Distributed Version Control


Transcription:

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

Why should I use a VCS?

Repositories Types of repositories: Private - only you and the selected contributors will see the content Public - everybody on the internet will be able to see the content But, there are also other options! How to create a repository: git init <folder> Through an interface on the selected host (GitHub)

Work area? Staging area?

Git Add Command: git add <name_of_file>; Can be folders (f.e. git add./folder) Can be multiple files (git add <file_1> <file_2>) Or you can be lazy! (git add --all OR git add.)

Git Commit Command: git commit; It will open a text editor so you can insert a commit message; Or, you can use the -m flag (f.e, git commit -m message ); You can sum up both previous commands: git add -a -m <message_to_input> ;

Git Push Command: git push Pushes all the committed files from the staging area to the repository

Git Fetch Command: git fetch Retrieves the files from the repository into the Working Area

Git Pull Command: git pull Actually, it s just git fetch +git merge Use the --rebase flag to rebase the commits instead of merging

Git Rebase Command: git rebase; Tries to order the commits, placing your commits at the top so you can push them to the remote repository. Sometimes some flags are required (--continue, --skip or --abort) depending on the changes made by the other contributors and in what do you want to commit.

Other commands Git Status (Command: git status) - shows the status of your files (added files, files that need to be added or removed, whether you are behind in the repository or you just need to push); Git Reset (Command: git reset HEAD) - resets your commit into the last state of the system (you ll typically need to add again the files); Git Checkout (Command: git checkout -- <path_to_file>) - undo the changes in the selected file, resetting it to the previous commit state; Git Rm (Command: git rm <path_to_file>) - removes the selected file from being tracked by Git;

Branches Branches are a great way to to split development of a project: You can create a branch to clean bugs and stabilise the codebase, and another to continue the development of a functionality. However, branches can lead to headaches! Problems with merging the branches, problems with bugs on one branch, etc So, we recommend that you stay with a single branch, and resort to rebasing the commits instead of merging; Command: git branch; You can list the branches existent (git branch); You can create a new one with (git branch <name_of_the_new_branch>); And you can also delete a branch (git branch -d <name_of_the_branch>);

Branches Command: git checkout; Now, to merge the branch Command: git merge; Use it with branches: Checkout a branch (git checkout <name_of_branch>); Create a branch and switch to that one (git checkout -b <name_of_new_branch>); Merge another branch with the actual branch (git merge <name_of_branch_to_merge>); A use case scenario: git checkout -d new_feature; git add new_file; git checkout master; git merge new_feature;

Blame Command: git blame <name_of_file>; Allows you to show who was the author of each line of a file and in what commit it was last placed

Grep Command: git grep <flags> <pattern> This command finds all the files with string that match the given pattern Useful flags: -n Show the line number where the string matches the pattern -i Ignore case of the letters in the pattern -l List all the files with strings that match the pattern

Git Tags Command: git tag <name_of_the_tag>; There are two kinds of Tags: Annotated, complete with checksum and integrity checking (f.e. git tag -a <tag>); Lightweight, just a simple pointer to a commit; You have to manually push the Tags (git push --tags);

Now, let s talk about Github!

We ve got a great help... Unlimited private repositories; Money to use on cloud services like Amazon Web Servers, Digital Ocean, Bitnami Software like Unreal Engine, Atom, Travis CI

A little about project management... Github gives you two powerful tools that helps you manage your project: Wiki - lets you document your code and provide additional information to anyone that needs; Issue Tracker - lets you manage which responsibilities are in a project, assign them to a developer, maintain an idea of what needs to be done;

Github s motto: Social Coding! Github lets you host free public repositories; Open source your projects! They want you to share your code and get help from the community! But how do I manage which commits are beneficial? Pull Requests! Organizations!

Share snippets of code: Gist Gist is the snippet tool of Github; Easy to use; Share it with whom you want; Formats like code; Can be public, or you can make it private;

Github Pages Serve a page about your project using Github! Github pages allow you to setup a blog using Jekyll; You can setup a custom URL! So, how do you create one? Create a public repository with the name (<your_username>.github.io); Done!

Markdown What is Markdown? Text-to-html conversion tool; Github supports Markdown in its pages (using Github-flavoured Markdown); Commit messages; Wikis; Issues;

You can also use SSH! You can create Webhooks! You can also setup SSH in order to push the commits! Don t need to insert to credentials for every push; Allows automation of pushes and pulls (we always use Fabric, a Python module, to push our commits onto our repositories); Webhooks let you modify something when there is an event: For example, send a new commit onto Travis CI (a continuous integration service);

Using github for your projects Ask for the student pack (https://education.github.com/pack) Create private repositories, you can setup one repository per project Add your collaborators (if you have any) and you re ready to go

Good practices of working with git Make short but meaningful commits (a new function, for example); Associate a descriptive message so you can know what was changed; Don t push code that doesn t work, except in some special situations; Distribute the work with issues or other collaboration tools (e.g. Trello); Don t hold your commits too long so your colleagues may know what is happening; Look at your colleague s commits, you may find there some bugs to fix or the solution to a problem that you don t know how to solve;

Finally, to wrap up... There are multiple GUI Clients: Other kinds of VCS: SourceTree (Windows); GitCola (Linux); Github Desktop (Windows, Mac); GitKraken; SVN; Subversion; CVS; Other Hosts: Gitlab; Bitbucket;

Questions?

Now let s test everything we learned... Create a github account (if you haven t one yet); Pair with a colleague, one person of the pair should create a public repository Both of you should clone the created repository; One person should create a file and push it to the repository (remember the steps: git add, git commit, git push); The other person should pull the file from the repository, change it and push again; Finally, let s simulate some conflicting changes. Both of you should change the file and commit it. When the second person tries to push the file, both of you will have to work together to solve the conflict.

Thanks for coming!