Introduction to Version Control using Git and Gitlab

Similar documents
Version control with GIT

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Version Control using Git and Github. Joseph Rivera

Introduction to Version Control

Version Control with Git. Dylan Nugent

Version Control with Git. Kate Hedstrom ARSC, UAF

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

Annoyances with our current source control Can it get more comfortable? Git Appendix. Git vs Subversion. Andrey Kotlarski 13.XII.

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

MOOSE-Based Application Development on GitLab

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

Git. A Distributed Version Control System. Carlos García Campos carlosgc@gsyc.es

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

Version Control with Git

Introduction to the Git Version Control System

Version Control with Git

MATLAB & Git Versioning: The Very Basics

PKI, Git and SVN. Adam Young. Presented by. Senior Software Engineer, Red Hat. License Licensed under

Git Basics. Christian Hanser. Institute for Applied Information Processing and Communications Graz University of Technology. 6.

Version Control Systems (Part 2)

Version Control Script

Introduc)on to Version Control with Git. Pradeep Sivakumar, PhD Sr. Computa5onal Specialist Research Compu5ng, NUIT

Version Control! Scenarios, Working with Git!

Source Control Systems

Git, GitHub & Web Hosting Workshop

Version Control with. Ben Morgan

Advanced Computing Tools for Applied Research Chapter 4. Version control

Introduction to Version Control with Git

Derived from Chris Cannam's original at, an.

Introduction to Version Control with Git

Revision control systems (RCS) and

Version Uncontrolled! : How to Manage Your Version Control

Version Control Systems

Version Control. Version Control

Software Configuration Management and Continuous Integration

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Using GitHub for Rally Apps (Mac Version)

FEEG Applied Programming 3 - Version Control and Git II

An Introduction to Collaborating with Version Control

Version Control Systems: SVN and GIT. How do VCS support SW development teams?

Data management on HPC platforms

Two Best Practices for Scientific Computing

An Introduction to Mercurial Version Control Software

Source code management systems

How to Create a Free Private GitHub Repository Educational Account

Continuous Integration. CSC 440: Software Engineering Slide #1

SOFTWARE DEVELOPMENT BASICS SED

Using Git for Centralized and Distributed Version Control Workflows - Day 3. 1 April, 2016 Presenter: Brian Vanderwende

Integrated version control with Fossil SCM

Distributed Version Control

Introduction to Subversion

Version Control with Mercurial and SSH

Version Control for Computational Economists: An Introduction

Version Control Tools

Distributed Version Control with Mercurial and git

Developer Workshop Marc Dumontier McMaster/OSCAR-EMR

Lab Exercise Part II: Git: A distributed version control system

An Introduction to Git Version Control for SAS Programmers

Version control systems. Lecture 2

Zero-Touch Drupal Deployment

Software Configuration Management. Slides derived from Dr. Sara Stoecklin s notes and various web sources.

CSE 374 Programming Concepts & Tools. Laura Campbell (Thanks to Hal Perkins) Winter 2014 Lecture 16 Version control and svn

Using Git for Project Management with µvision

DAVE Usage with SVN. Presentation and Tutorial v 2.0. May, 2014

How to set up SQL Source Control. The short guide for evaluators

Gitflow process. Adapt Learning: Gitflow process. Document control

Version Control Using Subversion. Version Control Using Subversion 1 / 27

Tuesday, October 18. Configuration Management (Version Control)

Software configuration management

An Introduction to Mercurial Version Control Software

Introducing Xcode Source Control

Work. MATLAB Source Control Using Git

Miguel A. Figueroa Villanueva Xabriel J. Collazo Mojica

Version Control. Luka Milovanov

1. History 2. Structure 3. Git Comparison 4. File Storage 5. File Tracking 6. Staging 7. Queues (MQ) 8. Merge Tools 9. Interfaces

Palantir.net presents Git

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

Adopting a Collaborative Software Development Process in the Scientific Community

Source Code Management for Continuous Integration and Deployment. Version 1.0 DO NOT DISTRIBUTE

Miguel A. Figueroa Villanueva Xabriel J. Collazo Mojica. ICOM 5047 Capstone Miguel A. Figueroa Villanueva University of Puerto Rico Mayagüez Campus

Pro Git. Scott Chacon *

Flumes Short User Guide to Subversion

Managing Source Code With Subversion

Git - Working with Remote Repositories

Git Tutorial - How to Create a Full Project

ECE 4750 Computer Architecture, Fall 2015 Tutorial 2: Git Distributed Version Control System

Git in control of your Change Management

Subversion. Nadir SOUALEM. Linux Users subversion client svn or higher. Windows users subversion client Tortoise 1.6.

Environnements et Outils de Développement Cours 7 Version Control

Continuous Integration

COLLABORATION BEST PRACTICES WITH GIT & GITHUB

The Hitchhiker s Guide to Github: SAS Programming Goes Social Jiangtang Hu d-wise Technologies, Inc., Morrisville, NC

Version control with Subversion

A Git Development Environment

Content. Development Tools 2(63)

How To Manage Source Code With Git

ALERT installation setup

Working Copy 1.4 users manual

Setting up a local working copy with SVN, MAMP and rsync. Agentic

Transcription:

Introduction to Version Control using Git and Gitlab About You Who already knows Git? Who knows any of these? CVS, Subversion, Mercurial, Baz, GnuArch 2 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab About This Presentation Objectives get convinced by version control systems learn practical Git skills learn about GitLab for collaboration hands on with some code : a LaTeX paper Don't Hesitate to ask questions to interrupt me to ping me after, when trying to practice 3 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 4 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Version Control: What? A version control system (VCS) records what you and your collaborators have done allows easy replication across machines allows you to easily see changes allows you to easily experiment new things Why dropbox/google drive/... is not sufficient safety of your data ownership of your data semantics of your changes Why CVS/Subversion might not be sufficient centralized : a host of the repository working in the train/plane/countryside speed limit Why? SVN-Git migration in progress. 8h to retrieve full SVN history, less than 1min to push full history to Git (same network)! @clem_bouillier 6 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab

Git Git (/ɡɪt/) is a distributed revision control and source code management (SCM) system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control system for software development. wikipedia History of Git open source initiated by Linus Torvalds first release: 7 April 2005 version 2.1.2: 30 September 2014 fast and efficient most used Good alternative: mercurial (hg) Starting with Git Initializing your project git init What's up? Deciding what is relevant 7 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab git add file1 file2 Let's try it 8 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab cp -r base mypaper ; cd mypaper git init git add... and more mypaper.tex cvpr.sty first: introduce yourself Recap Beginning git init git add... [-m...] Working git add... [-m...] 9 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Recap 2 10 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Keep your project clean: ignoring files.gitignore file(s) blabla.*,!blabla.my_precious, *~ What did I just modify? git diff [...] What happened? git log 11 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 12 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab

Nota Bene (vs CVS, Subversion) You have the complete repository have all commits locally commit often, fast and everywhere (train, plane, here) merge with 0-stress warning: commit backup Need to git add modifications Repository == project SVN has a big tree-shaped repository SVN allows to "checkout" any subtree Git works at the repository level you'll have a set of repository commits are at the repository level GUI for Git Bundled with git: git gui Many others (gitg, qgit, GitX, tortoisegit, Netbeans,...) graphical user interfaces for Git huge list of frontends and tools Customizing Git Introducing yourself 13 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab git config --global user.name "John Doe" git config --global user.email john@doe.com Fancy colors and shortcuts 14 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab git config --global color.ui true git config --global alias.st status git config --global alias.ci commit Configuration in ~/.gitconfig About History Remember git log? 15 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Each commit is written in stone parent(s) commit modifications sha1sum (e.g. cb6dc3cb1f4f5eb15c1d9b2b25ae741cd73c0554) can be diff'ed against git diff cb6dc3... can be retreived git checkout cb6dc3... 16 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Back to the Future: parallel universes git log gitk # or gitg git checkout 41474a33e098689b... emacs paper.tex gitk gitk --all... and more 17 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 18 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab

Recap Branch a label for a commit automatically follows on new commit ( ) Always commit before merging commit is cheap, easy and local you never loose anything when merging Use of sha1 or branch-name (e.g. brrrr) Shortcuts cb6dc3, brrrr, HEAD, HEAD^, HEAD~, HEAD~~, HEAD~2, HEAD~42, HEAD^2, cb6dc3^42, tagggg Recap 2 Moving in the history git checkout sha1-or-branch-name Creating a new branch at current position git checkout -b new-branch-name Merging brrrr into master git checkout master git merge brrrr Recap 3 19 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Automatic git merge automatic commit On conflicting git merge (partial merge) solve conflict git add Exploring history git log gitk [--all] log --graph --decorate --oneline --all --color Best Practices commit early and often 20 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab always commit before merge (or pull) use meaningful commit messages avoid committing binary files that change often (NB: word/excel/... are binary) generated files (that can be regenerated in a reasonable time) temporary files keep your clean don't put git repositories inside git repositories more 21 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 23 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab What is GitLab (and GitHub) GitLab a company providing support and advanced features an open source project (Community Edition) a web application collaboration platform hosting git repositories visualizing repositories managing issues/tickets GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. 24 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 25 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab

Let's Go Create a repository on GitLab Push our content link our repository to the remote repository (on GitLab) push the changes to this remote repository On another machine clone the repository make changes, commit and push them On this machine pull changes: fetch them and then merge Recap GitLab (and Git remotes) GitLab project == git repository (+ more) 26 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab More GitLab (additions to git) Groups groups of users (e.g., PhD student and supervisors) automatic access to the projects of the group Forking take a repository on GitLab make a personal copy of this repository (still on GitLab) Merge requests (pull requests in GitHub) ask for another repo to integrate changes from your fork Issues bug questions feature requests Wikis set of pages (also accessible as a git repository) 27 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab Things to Know at UJM SSH access is disabled always use "https://gitlab..." to clone your repository To avoid typing your login every time add your user name and @ after https:// e.g., git clone https:// er1234h@ gitlab.univ-st-etienne.fr/remi.emonet/pyqtidoteach.git in case you forgot, you can edit.git/config In case of problems while pushing big sets of commits error: RPC failed; result=22, HTTP code = 411 fatal: The remote end hung up unexpectedly just run git config http.postbuffer 524288000 28 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab How to Get an Account on GitLab For people with a UJM account open a ticket and asking to get an account on GitLab wait until you're notified it has been done visit http://gitlab.univ-st-etienne.fr/ use your UJM login/pass to connect ignore the email you'll receive For other people (interns, external collaborators) a person from UJM needs to open a ticket asking for the account providing an email and a name (for each collaborator) upon creation, you receive your credentials to log in, visit https://gitlab.univ-st-etienne.fr/ click on the Standard tab use the credentials you've been given 29 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 30 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 31 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab

Key Points Version control keep track of what happened store semantic snapshots/versions of your code Git distributed version control: you have a complete repository efficient and widely used one repository per project GitLab a place to share repositories (projects) visualization of the repositories, wiki pages, issue tracker, groups of users (e.g., PhD student and supervisors) available only via https, no SSH (in University Jean Monnet) Links interactive learning of branching in Git official website graphical user interfaces for Git for Git by a git, ask Linus Torvald Pro Git book (available online) Correspondence git <-> svn <-> none ; git push <-> svn commit git fetch <-> none git fetch ; git merge <-> svn update git pull == git fetch ; git merge NB: you can use git to collaborate with SVN users 32 / 32 Rémi Emonet Introduction to Version Control using Git and Gitlab 33 / 35 Rémi Emonet Introduction to Version Control using Git and Gitlab Going further git remote add git tag git rebase --amend git reflog git ls-files git revert git bisect Thanks! 34 / 35 Rémi Emonet Introduction to Version Control using Git and Gitlab 35 / 35 Rémi Emonet Introduction to Version Control using Git and Gitlab