Version control with GIT

Similar documents
Version Control with Git. Dylan Nugent

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

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

Introduction to Version Control

Version Control using Git and Github. Joseph Rivera

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

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

Version Control with Git. Kate Hedstrom ARSC, UAF

Introduction to the Git Version Control System

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

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

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

MOOSE-Based Application Development on GitLab

Introduction to Version Control with Git

Using Git for Project Management with µvision

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.

Version Control. Version Control

Source Control Systems

Version Control with. Ben Morgan

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

Version Control with Git

FEEG Applied Programming 3 - Version Control and Git II

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

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

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

MATLAB & Git Versioning: The Very Basics

Version Control with Git

Distributed Version Control with Mercurial and git

An Introduction to Git Version Control for SAS Programmers

Pro Git. Scott Chacon *

Version Control Systems

An Introduction to Mercurial Version Control Software

Version Control with Subversion

Two Best Practices for Scientific Computing

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

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

Version Control! Scenarios, Working with Git!

Introduction to Version Control with Git

Zero-Touch Drupal Deployment

Mercurial. Why version control (Single users)

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Introducing Xcode Source Control

Derived from Chris Cannam's original at, an.

Software Configuration Management and Continuous Integration

Work. MATLAB Source Control Using Git

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

Data management on HPC platforms

Revision control systems (RCS) and

Distributed Version Control

Version Control Script

Gitflow process. Adapt Learning: Gitflow process. Document control

CISC 275: Introduction to Software Engineering. Lab 5: Introduction to Revision Control with. Charlie Greenbacker University of Delaware Fall 2011

Developer Workshop Marc Dumontier McMaster/OSCAR-EMR

Content. Development Tools 2(63)

Version Control Tools

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

Unity Version Control

VFP Version Control with Mercurial

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

An Introduction to Mercurial Version Control Software

Version Control with Mercurial and SSH

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

A Git Development Environment

AVOIDING THE GIT OF DESPAIR

CS108, Stanford Handout #33. CVS in Eclipse

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11

Version control with Subversion

Version Uncontrolled! : How to Manage Your Version Control

What Does Tequila Have to Do with Managing Macs? Using Open Source Tools to Manage Mac OS in the Enterprise!

Integrated version control with Fossil SCM

Continuous Integration

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

BACKUP YOUR SENSITIVE DATA WITH BACKUP- MANAGER

CS 2112 Lab: Version Control

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

Introduction to Subversion

Working Copy 1.4 users manual

Git - Working with Remote Repositories

Version Control for Computational Economists: An Introduction

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

SOFTWARE DEVELOPMENT BASICS SED

Software configuration management

In depth study - Dev teams tooling

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

Version Control with Subversion and Xcode

Git Tutorial - How to Create a Full Project

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

Git Fusion Guide August 2015 Update

Using Subversion in Computer Science

Git Internals. Source code control and beyond by Scott Chacon

TortoiseGIT / GIT Tutorial: Hosting a dedicated server with auto commit periodically on Windows 7 and Windows 8

Surround SCM Best Practices

PxPlus Version Control System Using TortoiseSVN. Jane Raymond

Transcription:

AGV, IIT Kharagpur September 13, 2012

Outline 1 Version control system What is version control Why version control 2 Introducing GIT What is GIT? 3 Using GIT Using GIT for AGV at IIT KGP Help and Tips

What is version control? A version control system (also known as a Revision Control System) is a repository of files The easiest way to understand the concept of version control is to think of it as of the file history in Photoshop. Version control is much better than history in Photoshop: you also get a never-ending "undo", effortless backup, peace of mind, and a more organized way of storing different versions of your work. Additionally multiple people people can work in the same project at the same time.

How we manage it without VCS How do we Share code? Who do we determine who have the latest code? Can you really judge which one is actually latest? How do we merge work of team members? How do we go back to old code?

Why is version control important? File names and directory structures that are consistent for all team members. Making changes with confidence, and even reverting when needed. Relying on source control as the communication medium for your team. Easily work on different versions of your code. Understanding who made a change and when it happened.

Version Control is not a Backup System Having your files backed up on a remote server is a nice side effect of having a version control system. But you should not use your VCS like it was a backup system. Specially do not add binary file that are not needed to be tracked. Pay attention to committing semantically (see related changes ) To ignore files/folders in GIT, add them to.gitignore file.

Is Version Control only for source code? You can keep all kind of documents. Mechanical drawings, cad files. Circuit diagram files. For sharing excels/docs google docs may be used, and GIT can also be used. It might be a good idea to have separate repository for some of these tasks.

What is GIT? Git is a version control system. Speed Simple design Strong support for non-linear development (thousands of parallel branches) DVCS: Fully distributed (uses Hashes instead of revision numbers) Able to handle large projects like the Linux kernel efficiently (speed and data size)

Centralized Vs. Distributed

Git installation Windows Install msysgit for core functionality and TortoiseGit for user-friendly GUI. Linux (Ubuntu) Install git-core (sudo apt-get install git-core) There are many git interface available in the software center, which you can find by searching git" RabbitVCS integrates with file-manager and support GIT, SVN and Mercurial. Follow instructions from web-page to install. http://www.webupd8.org/2011/01/rabbitvcs-perfecttortoisesvn.html

Global settings and proxy Configure the user which will be used by git Add your name git config --global user.name Example Surname" Same for the email address git config --global user.email your.email@gmail.com" And most importantly add IIT KGP proxy git config --global http.proxy http://144.16.192.216:8080 All these settings are saved in /.gitconfig which you can edit manually too.

Create Create a new repository OR git init Checkout a repository git clone /path/to/repository git clone username@host:/path/to/repository (default protocol is ssh) git clone http://<username>@git.assembla.com/agv.git (we use this for http access behind IIT proxy) git clone http://<username>:<password>@git.assembla.com/agv.git

Workflow Your local repository consists of three "trees" maintained by git. The first one is your Working Directory which holds the actual files. The second one is the Index which acts as a staging area and finally the HEAD which points to the last commit you ve made.

Add, remove, move You can propose changes (add it to the Index) using git add <filename> The following command can be used to add all files, be careful to not add junk files, by setting.gitignore file properly. git add. To remove files(do not delete directly) git rm <filename> To move files/folders(do not move directly) git mv <filename>

Commit You can propose changes (add it to the Index) using git add <filename> This is the first step in the basic git workflow. To actually commit these changes use git commit -m Commit message" Now the file is committed to the HEAD, but not in your remote repository yet. To commit all local changes in tracked files with message use git commit -a -m Commit message" To amend local commit git commit -m initial commit git add forgotten_file git commit --amend

Pushing changes Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute git push origin master Change master to whatever branch you want to push your changes to. If you have more remote locations configured you can use them in place of origin.

Update & merge To update your local repository to the newest commit, execute git pull It fetch and merge remote changes in your working directory. Git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. You are responsible to merge those conflicts manually by editing the files shown by git. After changing, you need to mark them as merged with git add <filename> Download all changes from <remote>, but don t integrate into HEAD git fetch

Branching Branches are used to develop features isolated from each other. The master branch is the "default" branch when you create a repository. Use other branches for development and merge them back to the master branch upon completion. create a new branch named feature_x" and switch to it using git checkout -b feature_x

Branching contd. switch back to master git checkout master switch back to feature_x" git checkout feature_x" and delete the branch git branch -d feature_x a branch is not available to others unless you push the branch to your remote repository git push origin <branch> to merge another branch into your active branch (e.g. master), use git merge <branch> Before merging changes, you can also preview them by using git diff <source_branch> <target_branch>

Local Changes Files changed in working directory git status Changes to tracked files git diff Changes between ID1 and ID2 git diff <ID1> <ID2>

Commit History Show all commits, starting with newest git log Who changed what and when in a file git blame <file>

Undo Discard all local changes in your working directory you cannot undo a hard reset git reset --hard HEAD Discard local changes in a specific file git checkout HEAD <file> Revert a commit (by producing a new commit with contrary changes) git revert <commit-id> <commit-id> can be any hash-id of commit or HEAD.

Tagging It s recommended to create tags for software releases. You can create a new tag named 1.0.0 by executing git tag -a 1.1 -m "tag description" tag specific commit git tag 1.1 <commit-id> push tags git push --tags delete local tag git tag -d 1.0 delete tag from remote git push origin :refs/tags/1.0

Ignore certain files Git can be configured to ignore certain files and directories. This is configured via the.gitignore file. This file can be in any directory and can contain pattern for files. Ignore all bin directories bin Ignore all files ending with * You can also setup a global.gitignore file valid for all Git repositorie. Create a /.gitignore in your user directory. Configure Git to use this file as global.gitignore git config --global core.excludesfile /.gitignore

Keep directory structure Git will ignore empty directories, e.g. do not put them under version control. If you want to track such directories, is it convention to put files called ".gitkeep" in these directories. The file could be called anything; Git assigns no special significance to this name. As the directory now contains a file, Git will include it into its version control mechanism.

Tips for version control success Pull changes before you start working Make small commits (don t commit a whole day s work) Compile before commit Diff before commit Write useful messages

Other interesting commands to look at stash submodule rebase more at http://git-scm.com/docs/

Help & Documentation Get help on the command line $ git help <command> Official Git Website http://www.git-scm.com/ Free online resources http://progit.org http://book.git-scm.org http://gitref.org http://github.com/alexzeitler/gitcheatsheet http://www.kernel.org/pub/software/scm/git/docs/everyday.html http://www.vogella.com/articles/git/article.html http://ndpsoftware.com/git-cheatsheet.html

Thank you