Transcript

Distributed version control system

Agenda

Introduction to GIT

Working with GIT

GIT under the hood

Questions?

Introduction to GIT

Why use GIT?

Distributed

No single point of failure

Fast

Easy branching and merging

Data integrity

GIT usage

Source : Eclipse Community Survey

Staging Area

Any Workflow

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

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

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

Working with 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"

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

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

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

Creating a branch

A branch is just a movable pointer to a commit

HEAD is the pointer to the current branch

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

Basic Merging

Merge Conflicts

GIT under the hood

Initial state

File 1 modified

Add

Commit

Clone

Local commits

Origin Commits

Fetch

Merge

Push

Questions?

top related