Top Banner
Distributed version control system
33
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: GIT

Distributed version control system

Page 2: GIT

Agenda

Introduction to GIT

Working with GIT

GIT under the hood

Questions?

Page 3: GIT

Introduction to GIT

Page 4: GIT

Why use GIT?

Distributed

No single point of failure

Fast

Easy branching and merging

Data integrity

Page 5: GIT

GIT usage

Source : Eclipse Community Survey

Page 6: GIT

Staging Area

Page 7: GIT

Any Workflow

Page 8: GIT

Integrity

When you run "git add filename" a copy of the file is placed in the repository with a key that is SHA-1 hash of the file

This way Git can always validate the integrity of the files it return

The same is true for others objects stored in Git like commits

Page 9: GIT

BitbucketCloud hosted GIT and Mercurial

Competitor of GitHub but with free private repositories

Free account provides unlimited private repositories for up to 5 users

Wiki and issues tracking are also included

Web interface exposes GIT commands and enables to browse the cource code

Page 10: GIT

SourceTree and IDE

Free GIT and Mercurial client

Works on both Windows and Mac

Enable to use of most GIT commands from a GUI

Most IDE (Eclipse, IntelliJ, etc...) also support GIT

Page 11: GIT

Working with GIT

Page 12: GIT

Create a repository

Initializing a repository in an existing directory

Cloning an existing repository

The git repository will be created in a hidden subdirectory called ".git"

Page 13: GIT

Adding and commiting

You commit a file in two stages. First you add the file to the stagging area

Then when you have added all the changes you want to include, you commit your changes to the repositoty

Page 14: GIT

Fetching and pushing

To get the latest version of a remote repository you use the command fetch and then you merge any changes

To send you work to a remote repository you use the command push, but you need to merge your change before

Page 15: GIT

Tagging

Two type of tags : Lightweight and annotated

Tags need to be pushed to other repository

To work from a tag you need to create a branch

Page 16: GIT

Creating a branch

A branch is just a movable pointer to a commit

HEAD is the pointer to the current branch

Page 17: GIT

Checking out a branch

When you create a branch you don't change the HEAD

You need to checkout the branch to start working on it

Page 18: GIT

Basic Merging

Page 19: GIT

Merge Conflicts

Page 20: GIT

GIT under the hood

Page 21: GIT
Page 22: GIT
Page 23: GIT

Initial state

Page 24: GIT

File 1 modified

Page 25: GIT

Add

Page 26: GIT

Commit

Page 27: GIT

Clone

Page 28: GIT

Local commits

Page 29: GIT

Origin Commits

Page 30: GIT

Fetch

Page 31: GIT

Merge

Page 32: GIT

Push

Page 33: GIT

Questions?