Git for bzr users October 2010 - Aurélien Gâteau An attempt at making you comfortable when you have to work with a git repository.

Slides:



Advertisements
Similar presentations
Introduction To GIT Rob Di Marco Philly Linux Users Group July 14, 2008.
Advertisements

An Introduction By Sonali and Rasika.  Required for the project  Show the versions of your code in the course of development  Show versions of your.
om om GIT - Tips & Tricks / git.dvcs git-tips.com
Git
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Git. What’s Git? A British swear A Distributed Version Control System Developed in 2005 by Linus Torvalds for use on the Linux Kernel Git Logo by Jason.
Introduction to Version Control with SVN & Git CSC/ECE 517, Fall 2012 Titus Barik & Ed Gehringer, with help from Gaurav.
Peter Ogden and Josh Levine.  Motivation  High level overview  Walk through the common operations  How not to break things (too badly)
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Introduction to Version Control with Git CSC/ECE 517, Fall 2014 A joint project of the CSC/ECE 517 staff, including Titus Barik, Gaurav Tungatkar, Govind.
Git Super Basics. What is Git? Version Control System (VCS) Successor to SVN in the Drupal eco-system A tool.
1 GIT NOUN \’GIT\ A DISTRIBUTED REVISION CONTROL AND SOURCE CODE MANAGEMENT (SCM) SYSTEM WITH AN EMPHASIS ON SPEED. INITIALLY DESIGNED AND DEVELOPED BY.
Sofia Event Center May 2014 Martin Kulov Git For TFS Developers.
GIT.
Intro to Git presented by Brian K. Vagnini Hosted by.
Page 1 TBD 12/08/2014 Formation GIT Laurent Kappel Groupe SII 65, rue de Bercy Paris Tél : Fax :
Falcons Git Usage Andre Pool Version 2.0 October 2015 / Veldhoven.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
Gittutorial(7) NAME gittutorial - A tutorial introduction to git (for version or newer) SYNOPSIS git * DESCRIPTION This tutorial explains how to.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
GIT: What, how and why ? Part 1: Basics. What do I know about git? Started using it for experiments on April 2009 Moved all voms development on git on.
INTRODUCTION TO GIT. Install Egit for eclipse Open eclipse->Help->Install New Software Search for one of the following -
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Introduction to Git Thomas.
Getting Started with Git Presented by Jim Taylor Rooty Hollow, Owner Verizon Wireless, Senior Programmer/Analyst Git User for 6 years.
Jun-Ru Chang Introduction GIT Jun-Ru Chang
Backing up a machine with git
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association STEINBUCH CENTRE FOR COMPUTING - SCC
Basics of GIT for developers and system administrators
CS5220 Advanced Topics in Web Programming Version Control with Git
Introduction to GitHub
M.Sc. Juan Carlos Olivares Rojas
Information Systems and Network Engineering Laboratory II
I Don’t Git It: A beginner’s guide to git Presented by Mathew Robinson
Primož Gabrijelčič Git for Programmers Primož Gabrijelčič
Version Control Systems
11 Version control (part 2)
CReSIS Git Tutorial.
Git Practice walkthrough.
SSE2034: System Software Experiment 3 Spring 2016
Version Control overview
File Version Control System
CS5220 Advanced Topics in Web Programming Version Control with Git
Git branches and remotes
Software Engineering for Data Scientists
An introduction to version control systems with Git
SU Development Forum Introduction to Git - Save your projects!
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
An introduction to version control systems with Git
Anatomy of a Git Project
The Big Picture
SIG: Open Week 1: GitHub Tim Choh.
An introduction to version control systems with Git
Source Code Repository
Version Control System - Git
Version control with Git
Version Control with Git and GitHub
Git Introduction.
Git GitHub.
Introduction to The Git Version Control System
Advanced Git for Beginners
Presentation transcript:

Git for bzr users October Aurélien Gâteau An attempt at making you comfortable when you have to work with a git repository

First time setup Tell git about you: git config --global user.name “Aurélien Gâteau” git config --global user. \

Getting a working copy git clone git clone git://github.com/agateau/yokadi.git Initialized empty Git repository in /home/aurelien/tmp/yokadi/.git/ remote: Counting objects: 3217, done. remote: Compressing objects: 100% (1121/1121), done. remote: Total 3217 (delta 2078), reused 3196 (delta 2066) Receiving objects: 100% (3217/3217), KiB | 121 KiB/s, done. Resolving deltas: 100% (2078/2078), done

Inspecting history git log commit 7ddc cae b01f4c Author: Séb... R... Date: Tue Jul 6 14:15: Add n_list simple test case commit f0cea777729e12720d127cf e52a4048c4 Author: Séb... R... Date: Tue Jul 6 14:11: Fix n_list crash commit fc28ba71235b35c7676a431665f Author: Séb... R... Date: Tue Jul 6 14:03: Add decryption feature to t_list/n_list and textlist renderer

Specifying revisions By their SHA1 (no revision numbers) Can be truncated as long as it is not ambiguous By tag or branch name HEAD is the latest commit (= -r-1 in bzr) You can append suffixes: ^: parent commit (HEAD^ = -r-2 in bzr) ~N: N-th parent of commit (HEAD~4 = -r-5 in bzr) man git-rev-parse for more creative way to specify revisions

Displaying diffs git diff (= bzr diff -r ) git show (= bzr diff -c, but show message and diff) git diff f0cea77..7ddc777 diff --git a/src/yokadi/tests/tasktestcase.py b/src/yokadi/tests/tasktestcase.py index 39c98b7..237eaa a/src/yokadi/tests/tasktestcase.py +++ b/src/yokadi/tests/tasktestcase.py -141,6 +141,18 class TaskTestCase(unittest.TestCase): "-f plain", "-f xml", "-f html", "-f csv"): self.cmd.do_t_list(line) + def testNlist(self): + tui.addInputAnswers("y") (...)

Editing git status is the equivalent of bzr status vi NEWS git status # On branch master # Changed but not updated: # (use "git add..." to update what will be committed) # (use "git checkout --..." to discard changes in working directory) # # modified: NEWS # no changes added to commit (use "git add" and/or "git commit -a")

Editing Even existing files must be added before they are committed: git commit no changes added to commit (use "git add" and/or "git commit -a") git add NEWS git status # On branch master # Changes to be committed: # (use "git reset HEAD..." to unstage) # # modified: NEWS git commit -m 'Added latest news' [master 69b0d3a] Added latest news 1 files changed, 0 insertions(+), 1 deletions(-)

The staging area Aka “the index” or “the cache” A place to construct your commits git add Unstaged changes Staging areaCommit git commit git add

Local branches A checkout in bzr is a branch, whereas a checkout in git is a repository (collection of branches) Default branch is called “master” Main branch commands: git branch: lists available branches git checkout : switches to branch git checkout -b : creates branch and switches to it

Local branches git branch * master git checkout -b new-feature Switched to a new branch 'new-feature' git branch master * new-feature git checkout master Switched to branch 'master' Your branch is ahead of 'origin/master' by 1 commit. Note the message from “git checkout master”. This is because we have a change which has not been pushed yet.

Merging Two ways to merge: merge and rebase ABC DEF ABC E'D' Rebasing (git rebase master)Merging (git merge master) maste r *new- feature ABC DE Do not rebase published commits!

Remotes A remote is a “bookmark” to a distant repository Default remote is “origin”, set when repository was cloned Use “git remote -v” to list remotes with the urls they point to (two urls per remote): git remote -v origin git://github.com/agateau/yokadi.git (fetch) origin git://github.com/agateau/yokadi.git (push)

Remote branches “git clone” does two things: clones all branches as “remote” branches creates a local branch named “master”, tracking “origin/master” origin - master local repository - origin/master - origin/0.9 - origin/ master - new-feature Remote branches Local branches track s

Remote branches git branch -a: lists all branches (local and remote) git branch -a master * new-feature remotes/origin/0.10 remotes/origin/0.9 remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/HEAD is a shortcut which makes it possible to refer to origin/master as origin

Working on a remote branch You need to create a tracking local branch git checkout -t origin/0.10 Branch 0.10 set up to track remote branch 0.10 from origin. Switched to a new branch '0.10' local repository - origin/master - origin/0.9 - origin/ master - new-feature Remote branches Local branches track s

Updating from a repository Simple version: git pull or git pull --rebase What happens under the hood: git fetch: updates the remote branches from the remote repository git merge: updates the remote-tracking local branches from the remote branches Git pull will stop if your working copy contains uncommitted changes

Publishing changes Simplistic version: git format-patch Generates one.patch file per commit for, named according to the first line of the commit message Can then be applied with git am *.patch git format-patch origin/master 0001-Updated.patch 0002-Fixed-the-editor.patch

Publishing changes To push changes to another repository, use git push git push without any argument: push all changes from tracking branches to default repository (origin) git push : push changes from to example: “git push origin master” push all changes from master to the master branch in the origin repository

Tools Lots of tools exist around git tig: command line tool to browse history gitk: tcl/tk tool to browse history git gui: tcl/tk tool to create commits giggle: gtk+ tool to browse history git grep: greps through whole repository, faster than grep Show current git branch in your prompt (search for “git branch in prompt” on the internet for several examples)

Configuration Options can be set per repository (.git/config) or per account (~/.gitconfig) Git uses.ini style files Files can be edited by hand or with git config: git config edits.git/config git config --global edits ~/.gitconfig if is empty, it prints the current value

Useful configuration setup [color] branch = auto diff = auto status = auto [alias] pr = pull --rebase st = status ci = commit log1 = log --pretty=oneline --decorate Paste this in your ~/.gitconfig

The end You are now git savvy! (hopefully) Questions?