SlideShare a Scribd company logo
git – Basic Crash Course
Introduction
BITS Firefox Community | Lecture Series - Git
DRIVES
Nilay Binjola
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Debian/Ubuntu based Linux Distributions
$ apt-get install git
Fedora/Redhat based Linux Distributions
$ yum install git
OpenSUSE
$ zypper install git
Arch Linux
$ pacman -S git
Windows
1. Download latest version (1.9.4) from http://git-scm.com/download/win
2. Run the installer
3. Select “Run Git and included Unix tools from the Windows Command Prompt”
4. Select “Checkout Windows-style, commit Unix-style line endings”
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Username and Email
$ git config --global user.name “Nilay Binjola"
$ git config –global user.email “nilaybinjola@gmail.com”
Activate colored messages
$ git config --global color.status auto
$ git config --global color.branch auto
More git configurations settings - http://git-scm.com/book/en/v2/Customizing-Git-Git-
Configuration
And you are all set!
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Git has extensive documentation all over the internet. Some of them are:-
1. Pro Git book by Scott Chacon and Ben Straub - http://git-scm.com/book/en/v2
2. Git Reference - http://gitref.org/
3. Git Manual - $ git help <verb>
4. Stack Overflow - http://stackoverflow.com/questions/tagged/git
5. Google – http://www.google.com
“Most images/figures/diagrams in this presentation are taken from [1]”
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Git is a distributed revision control system with an emphasis on speed, data integrity, and
support for distributed, non-linear workflows.
• What is Version Control?
• Version control is a system that records changes to a file or set of files over time so
that you can recall specific versions later.
• It allows you to revert files back to a previous state, revert the entire project back
to a previous state, compare changes over time, see who last modified something
that might be causing a problem, who introduced an issue and when, and more.
• Categories of Version Control
1. Local Version Control Systems
2. Centralized Version Control Systems
3. Distributed Version Control Systems
“A VCS generally means that if you screw things up, you can easily recover.”
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Local Version Control System
Eg: RCS (MAC OS)
Centralized Version Control System
Eg: CVS, Subversion, Perforce etc.
Introduction
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Eg: Git, Mercurial, Bazaar, DARCS etc.
• Clients check-out entire history of project
from central server instead of just 1
snapshot like CVCS.
• Supports hierarchical models unlike CVCS.
• Allows users to work productively when not
connected to a network.
• Makes most operations faster – No need to
communicate with a central server.
• Non-Linear Workflows – Anyone can be
anything since everyone has the complete
repository.
• Distributed - Protection against data loss.
Basics and Working Principles
BITS Firefox Community | Lecture Series - Git Nilay Binjola
• Git stores the snapshot of the file along with a reference to it.
• If file has not changed, Git does not store file again
• Everything is check-summed before storage using SHA-1 Hash
• Version numbers or commit numbers are first 7 characters of the SHA-1 Hash. Eg:
5610e3b
Basics and Working Principles
BITS Firefox Community | Lecture Series - Git Nilay Binjola
• Git Workflow:-
1. Clone/Fork/Initialise a git repository and checkout a snapshot to Working
Directory
2. Modify Files in the Working Directory
3. Stage the files you want to be committed by adding snapshots of them to staging
area
4. Commit your staged files.
• Git stores all its data in a .git
directory in the root of the project.
• Working Directory – Latest checkout
of the repository along with your
changes.
• Staging Area – Stores information of
what is to be committed next.
• Staging Area a.k.a Index
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
git-init
Create an empty git repository or reinitialize an existing one
• Creates a new subdirectory named .git that contains all of your necessary repository
files
• An initial HEAD file that references the HEAD of the master branch is also created.
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Creating a project directory
$ mkdir my-awesome-project
$ cd my-awesome-project
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Initialize a Git Repository using git-init
$ mkdir my-awesome-project
$ cd my-awesome-project
$ git init
Initialized empty Git repository in E:/my-awesome-project/.git/
Nothing here
Repo History
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Start working on the project. In this example, create a file
with some text in it.
$ mkdir my-awesome-project
$ cd my-awesome-project
$ git init
$ echo “My First File” > first.txt
Nothing here
Repo History
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
git-status
Show the working tree status
• Displays paths that have differences between
• The index file and the current HEAD commit.
• The working tree and the index file
• Paths in the working tree that are not tracked by git
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Check status of your git repository using git-status. See
tracked/untracked files and status of modified files.
$ mkdir my-awesome-project
$ cd my-awesome-project
$ git init
$ echo “My First File” > first.txt
$ git status
# On branch master
# Initial commit
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# first.txt
nothing added to commit but untracked files present (use "git
add" to track)
Nothing here
Repo History
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
git-add
Add file contents to the index
• Updates the index using the current content found in the working tree, to prepare the
content staged for the next commit
• Typically adds the current content of existing paths as a whole
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Add the untracked file “first.txt” to the stage area using git-
add.
$ mkdir my-awesome-project
$ cd my-awesome-project
$ git init
$ echo “My First File” > first.txt
$ git status
$ git add first.txt
Nothing here
Repo History
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Check the status of your git repository again and see the
difference.
$ git init
$ echo “My First File” > first.txt
$ git status
$ git add first.txt
$ git status
# On branch master
# Initial commit
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
# new file: first.txt
Nothing here
Repo History
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
git-commit
Record changes to the repository
• Stores the current contents of the index in a new commit along with a log message from
the user describing the changes.
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Commit your staged file(s) and check status of the git
repository again to observe changes.
$ git add first.txt
$ git commit –m “First Commit”
[master (root-commit) a231f12] First Commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 first.txt
$ git status
# On branch master
nothing to commit, working directory clean
a231f12
Repo History
HEAD
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
git-log
Show commit logs
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Use git-log to view commits history and commit messages in
chronological order.
$ git commit –m “First Commit”
$ git status
$ git log
commit a231f123102112daf8291894aa404f0c2b8fd5fb
Author: Nilay Binjola <nilaybinjola@gmail.com>
Date: Mon Nov 10 16:26:39 2014 +0530
First Commit a231f12
Repo History
HEAD
Commands and Live Demonstration
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Keep working on project and keep committing work regularly.
$ echo “Second File” > second.txt
$ git add .
$ git commit –m “Second Commit”
$ git log
commit 5df0c533cfd8dac626fef959ee9c0b4560ea07c5
Author: Nilay Binjola <nilaybinjola@gmail.com>
Date: Mon Nov 10 16:36:35 2014 +0530
Second Commit
commit a231f123102112daf8291894aa404f0c2b8fd5fb
Author: Nilay Binjola <nilaybinjola@gmail.com>
Date: Mon Nov 10 16:26:39 2014 +0530
First Commit
a231f12
Repo History
HEAD 5df0c53
Other Commands
BITS Firefox Community | Lecture Series - Git Nilay Binjola
git-diff
Show changes between commits, commit and working tree, etc.
git-rm
Remove files from the working tree and from the index.
git-mv
Move or rename a file, a directory, or a symlink.
git-tag
Create, list, delete or verify a tag object signed with GPG.
git-clone
Clone a repository into a new directory.
Other Commands
BITS Firefox Community | Lecture Series - Git Nilay Binjola
$ git commit --amend
Used to amend the tip of the current branch. The commit you create replaces the current
tip.
$ git reset HEAD <file name>
Unstage a staged file.
$ git checkout -- <file name>
Revert file back to what it looked like when you last committed.
$ git reset –hard <commit>
Will destroy any local modifications. Will revert Working Directory to commit status.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
• Diverge from the main line of development and continue to do work without messing
with that main line.
• New commits are recorded in the history for the current branch, which results in a fork
in the history of the project.
• The git branch command lets you create, list, rename, and delete branches.
• It doesn’t let you switch between branches or put a forked history back together
again.
When you want to add a new feature or fix a bug—no matter how big or how small—you
spawn a new branch to encapsulate your changes.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
A basic project repository commit tree.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Creating a new branch.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Committing changes to the new branch “iss53”.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Checking out a new branch from master (after switching to master) and working on it.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Merging branch “hotfix” with master.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Checking out branch “iss53” and working on it.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
Merging branch “iss53” to branch “master”
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
All branches merged. New Commit created.
Branching and Merging - Basics
BITS Firefox Community | Lecture Series - Git Nilay Binjola
• Edit Collision - If you changed the same part of the same file differently in the two
branches you’re merging together.
• Choose either one side of the merger or the other.
• Removed File Conflict - one person edits a file, and another person deletes that file in
their branch.
• Use git mergetool for better visualization etc.
Further Reading
BITS Firefox Community | Lecture Series - Git Nilay Binjola
 Practice using dummy repositories
 Read on:-
 Branching and Merging
 Working with Remotes
 Tagging
 Git Hooks
 Distributed Workflows
 Read the Pro Git Community book on their main website
 Fun online git tutorial - https://try.github.io/levels/1/challenges/1
 Start using Git for your projects hosted on Github, BitBucket.
"What Would CVS Not Do?“ – Linus Torvalds

More Related Content

What's hot

Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
Yoad Snapir
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
Git real slides
Git real slidesGit real slides
Git real slides
Lucas Couto
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Houari ZEGAI
 
Github basics
Github basicsGithub basics
Github basics
Radoslav Georgiev
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
Md. Ahsan Habib Nayan
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
Safique Ahmed Faruque
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 

What's hot (20)

Introduction git
Introduction gitIntroduction git
Introduction git
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Git training v10
Git training v10Git training v10
Git training v10
 
git and github
git and githubgit and github
git and github
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Github basics
Github basicsGithub basics
Github basics
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 

Similar to Git - Basic Crash Course

Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
UshaSuray
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
Things Lab
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
Cristian Lucchesi
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur16
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
dropsolid
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
atishgoswami
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan Maulana
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
Robert Lee-Cann
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
Zeeshan Khan
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
BigBlueHat
 
Git slides
Git slidesGit slides
Git slides
Nguyen Van Hung
 
Git
GitGit
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
KeerthanaJ32
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 

Similar to Git - Basic Crash Course (20)

Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Git introduction
Git introductionGit introduction
Git introduction
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Git 101
Git 101Git 101
Git 101
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Git slides
Git slidesGit slides
Git slides
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 

Recently uploaded

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Semiosis Software Private Limited
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 

Recently uploaded (20)

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 

Git - Basic Crash Course

  • 1. git – Basic Crash Course
  • 2. Introduction BITS Firefox Community | Lecture Series - Git DRIVES Nilay Binjola
  • 3. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola
  • 4. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola Debian/Ubuntu based Linux Distributions $ apt-get install git Fedora/Redhat based Linux Distributions $ yum install git OpenSUSE $ zypper install git Arch Linux $ pacman -S git Windows 1. Download latest version (1.9.4) from http://git-scm.com/download/win 2. Run the installer 3. Select “Run Git and included Unix tools from the Windows Command Prompt” 4. Select “Checkout Windows-style, commit Unix-style line endings”
  • 5. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola Username and Email $ git config --global user.name “Nilay Binjola" $ git config –global user.email “nilaybinjola@gmail.com” Activate colored messages $ git config --global color.status auto $ git config --global color.branch auto More git configurations settings - http://git-scm.com/book/en/v2/Customizing-Git-Git- Configuration And you are all set!
  • 6. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola Git has extensive documentation all over the internet. Some of them are:- 1. Pro Git book by Scott Chacon and Ben Straub - http://git-scm.com/book/en/v2 2. Git Reference - http://gitref.org/ 3. Git Manual - $ git help <verb> 4. Stack Overflow - http://stackoverflow.com/questions/tagged/git 5. Google – http://www.google.com “Most images/figures/diagrams in this presentation are taken from [1]”
  • 7. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola Git is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. • What is Version Control? • Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. • It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more. • Categories of Version Control 1. Local Version Control Systems 2. Centralized Version Control Systems 3. Distributed Version Control Systems “A VCS generally means that if you screw things up, you can easily recover.”
  • 8. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola Local Version Control System Eg: RCS (MAC OS) Centralized Version Control System Eg: CVS, Subversion, Perforce etc.
  • 9. Introduction BITS Firefox Community | Lecture Series - Git Nilay Binjola Eg: Git, Mercurial, Bazaar, DARCS etc. • Clients check-out entire history of project from central server instead of just 1 snapshot like CVCS. • Supports hierarchical models unlike CVCS. • Allows users to work productively when not connected to a network. • Makes most operations faster – No need to communicate with a central server. • Non-Linear Workflows – Anyone can be anything since everyone has the complete repository. • Distributed - Protection against data loss.
  • 10. Basics and Working Principles BITS Firefox Community | Lecture Series - Git Nilay Binjola • Git stores the snapshot of the file along with a reference to it. • If file has not changed, Git does not store file again • Everything is check-summed before storage using SHA-1 Hash • Version numbers or commit numbers are first 7 characters of the SHA-1 Hash. Eg: 5610e3b
  • 11. Basics and Working Principles BITS Firefox Community | Lecture Series - Git Nilay Binjola • Git Workflow:- 1. Clone/Fork/Initialise a git repository and checkout a snapshot to Working Directory 2. Modify Files in the Working Directory 3. Stage the files you want to be committed by adding snapshots of them to staging area 4. Commit your staged files. • Git stores all its data in a .git directory in the root of the project. • Working Directory – Latest checkout of the repository along with your changes. • Staging Area – Stores information of what is to be committed next. • Staging Area a.k.a Index
  • 12. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola git-init Create an empty git repository or reinitialize an existing one • Creates a new subdirectory named .git that contains all of your necessary repository files • An initial HEAD file that references the HEAD of the master branch is also created.
  • 13. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Creating a project directory $ mkdir my-awesome-project $ cd my-awesome-project
  • 14. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Initialize a Git Repository using git-init $ mkdir my-awesome-project $ cd my-awesome-project $ git init Initialized empty Git repository in E:/my-awesome-project/.git/ Nothing here Repo History
  • 15. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Start working on the project. In this example, create a file with some text in it. $ mkdir my-awesome-project $ cd my-awesome-project $ git init $ echo “My First File” > first.txt Nothing here Repo History
  • 16. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola
  • 17. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola git-status Show the working tree status • Displays paths that have differences between • The index file and the current HEAD commit. • The working tree and the index file • Paths in the working tree that are not tracked by git
  • 18. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Check status of your git repository using git-status. See tracked/untracked files and status of modified files. $ mkdir my-awesome-project $ cd my-awesome-project $ git init $ echo “My First File” > first.txt $ git status # On branch master # Initial commit # Untracked files: # (use "git add <file>..." to include in what will be committed) # first.txt nothing added to commit but untracked files present (use "git add" to track) Nothing here Repo History
  • 19. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola git-add Add file contents to the index • Updates the index using the current content found in the working tree, to prepare the content staged for the next commit • Typically adds the current content of existing paths as a whole
  • 20. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Add the untracked file “first.txt” to the stage area using git- add. $ mkdir my-awesome-project $ cd my-awesome-project $ git init $ echo “My First File” > first.txt $ git status $ git add first.txt Nothing here Repo History
  • 21. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Check the status of your git repository again and see the difference. $ git init $ echo “My First File” > first.txt $ git status $ git add first.txt $ git status # On branch master # Initial commit # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # new file: first.txt Nothing here Repo History
  • 22. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola git-commit Record changes to the repository • Stores the current contents of the index in a new commit along with a log message from the user describing the changes.
  • 23. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Commit your staged file(s) and check status of the git repository again to observe changes. $ git add first.txt $ git commit –m “First Commit” [master (root-commit) a231f12] First Commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 first.txt $ git status # On branch master nothing to commit, working directory clean a231f12 Repo History HEAD
  • 24. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola git-log Show commit logs
  • 25. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Use git-log to view commits history and commit messages in chronological order. $ git commit –m “First Commit” $ git status $ git log commit a231f123102112daf8291894aa404f0c2b8fd5fb Author: Nilay Binjola <nilaybinjola@gmail.com> Date: Mon Nov 10 16:26:39 2014 +0530 First Commit a231f12 Repo History HEAD
  • 26. Commands and Live Demonstration BITS Firefox Community | Lecture Series - Git Nilay Binjola Keep working on project and keep committing work regularly. $ echo “Second File” > second.txt $ git add . $ git commit –m “Second Commit” $ git log commit 5df0c533cfd8dac626fef959ee9c0b4560ea07c5 Author: Nilay Binjola <nilaybinjola@gmail.com> Date: Mon Nov 10 16:36:35 2014 +0530 Second Commit commit a231f123102112daf8291894aa404f0c2b8fd5fb Author: Nilay Binjola <nilaybinjola@gmail.com> Date: Mon Nov 10 16:26:39 2014 +0530 First Commit a231f12 Repo History HEAD 5df0c53
  • 27. Other Commands BITS Firefox Community | Lecture Series - Git Nilay Binjola git-diff Show changes between commits, commit and working tree, etc. git-rm Remove files from the working tree and from the index. git-mv Move or rename a file, a directory, or a symlink. git-tag Create, list, delete or verify a tag object signed with GPG. git-clone Clone a repository into a new directory.
  • 28. Other Commands BITS Firefox Community | Lecture Series - Git Nilay Binjola $ git commit --amend Used to amend the tip of the current branch. The commit you create replaces the current tip. $ git reset HEAD <file name> Unstage a staged file. $ git checkout -- <file name> Revert file back to what it looked like when you last committed. $ git reset –hard <commit> Will destroy any local modifications. Will revert Working Directory to commit status.
  • 29. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola • Diverge from the main line of development and continue to do work without messing with that main line. • New commits are recorded in the history for the current branch, which results in a fork in the history of the project. • The git branch command lets you create, list, rename, and delete branches. • It doesn’t let you switch between branches or put a forked history back together again. When you want to add a new feature or fix a bug—no matter how big or how small—you spawn a new branch to encapsulate your changes.
  • 30. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola A basic project repository commit tree.
  • 31. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola Creating a new branch.
  • 32. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola Committing changes to the new branch “iss53”.
  • 33. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola Checking out a new branch from master (after switching to master) and working on it.
  • 34. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola Merging branch “hotfix” with master.
  • 35. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola Checking out branch “iss53” and working on it.
  • 36. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola Merging branch “iss53” to branch “master”
  • 37. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola All branches merged. New Commit created.
  • 38. Branching and Merging - Basics BITS Firefox Community | Lecture Series - Git Nilay Binjola • Edit Collision - If you changed the same part of the same file differently in the two branches you’re merging together. • Choose either one side of the merger or the other. • Removed File Conflict - one person edits a file, and another person deletes that file in their branch. • Use git mergetool for better visualization etc.
  • 39. Further Reading BITS Firefox Community | Lecture Series - Git Nilay Binjola  Practice using dummy repositories  Read on:-  Branching and Merging  Working with Remotes  Tagging  Git Hooks  Distributed Workflows  Read the Pro Git Community book on their main website  Fun online git tutorial - https://try.github.io/levels/1/challenges/1  Start using Git for your projects hosted on Github, BitBucket. "What Would CVS Not Do?“ – Linus Torvalds