SlideShare a Scribd company logo
GIT
FOR DEVELOPERS
Hacen Dadda
◉ Web Developer
◉ Consultant
◉ CTO @
@hacentech
hdadda@hivedigit.com
http://about.me/hacen
BEFORE VCS
BEFORE VCS
TIME
BEFORE VCS
?
BEFORE VCS
A 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.
Even though the examples in this book
show software source code as the files
under version control, in reality any type of
file on a computer can be placed under
version control.
WHAT IS GIT ?
In 2005, the Linux development community (and in
particular Linus Torvalds) develop their own tool based on
some of the lessons they learned while using BitKeeper.
Some of the goals of the new system were as follows:
◉ Speed
◉ Simple design
◉ Strong support for non-linear development
◉ Fully distributed
◉ Able to handle large projects
WHY GIT ? Distributed
WHO USE GIT ?
BIG project ?
The linux kernel 3.13 release
◉ + 15 million line of code
◉ 12 000 non-megre commits ( non accepted code )
◉ 446K lines of code added
◉ 1 339 contributors
INSTALLING GIT
◉ Linux (Ubuntu)
sudo apt-get install git-all
Or
sudo dpkg -i git_***.deb
◉ Windows
https://git-scm.com/download/win
◉ Mac
https://git-scm.com/download/mac
Git Configuration
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
create a new repository
create a new directory, open it and perform a
git init
to create a new git repository.
checkout a repository
create a working copy of a local repository by running the command
git clone /path/to/repository
when using a remote server, your command will be
git clone username@host:/path/to/repository
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.
workflow
add & commit
You can propose changes (add it to the Index) using
git add <filename>
git add .
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.
log
in its simplest form, you can study repository history using.. git log
You can add a lot of parameters to make the log look like what you want.
To see a very compressed log where each commit is one line:
git log --pretty=oneline
Or maybe you want to see an ASCII art tree of all the branches,
decorated with the names of tags and branches:
git log --graph --oneline --decorate --all
GITIGNORE
Tools
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 not cloned an existing repository and want to connect your
repository to a remote server, you need to add it with
git remote add origin <server>
Now you are able to push your changes to the selected remote server
update & merge
to update your local repository to the newest commit, execute
git pull origin master
in your working directory to fetch and merge remote changes.
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.
branching
create a new branch named "feature_x" and switch to it using
git checkout -b feature_x
switch back to master
git checkout master
and delete the branch again
git branch -d feature_x
Create a new branch
git checkout -b some_feature
branching
to merge another branch into your active branch (e.g. master), use
git merge <branch>
in both cases 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.
Merge a branch
git checkout master
git merge some_feature
Git workflow
Basic branches
Feature Branches
Release Branches
Maintenance Branches
Workflow
(Branching model)
Read:
A successful Git
branching model
By:
Vincent Driessen
Workflow (Branching model)
Any questions ?
Thanks!

More Related Content

What's hot

What's hot (20)

Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Git commands
Git commandsGit commands
Git commands
 
Git presentation
Git presentationGit presentation
Git presentation
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
What the Git? - WordCamp Atlanta
What the Git? - WordCamp AtlantaWhat the Git? - WordCamp Atlanta
What the Git? - WordCamp Atlanta
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Git presentation
Git presentationGit presentation
Git presentation
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
 
Git basic
Git basicGit basic
Git basic
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Git overview
Git overviewGit overview
Git overview
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 

Similar to Git for developers

Similar to Git for developers (20)

Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Git hub
Git hubGit hub
Git hub
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
 
Git 101
Git 101Git 101
Git 101
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git
GitGit
Git
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
Formation git
Formation gitFormation git
Formation git
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git
GitGit
Git
 
Git 101
Git 101Git 101
Git 101
 

More from Hacen Dadda

More from Hacen Dadda (6)

Scrum In Action - Algiers Tech Meetup
Scrum In Action - Algiers Tech MeetupScrum In Action - Algiers Tech Meetup
Scrum In Action - Algiers Tech Meetup
 
software engineering هندسة البرمجيات
software engineering هندسة البرمجياتsoftware engineering هندسة البرمجيات
software engineering هندسة البرمجيات
 
Linux basics ubuntu
Linux basics ubuntuLinux basics ubuntu
Linux basics ubuntu
 
Business plan (le plan financier)
Business plan (le plan financier)Business plan (le plan financier)
Business plan (le plan financier)
 
Business model - Programme FIE - ENSV
Business model - Programme FIE - ENSVBusiness model - Programme FIE - ENSV
Business model - Programme FIE - ENSV
 
Google Web Toolkit (GWT)
Google Web Toolkit (GWT)Google Web Toolkit (GWT)
Google Web Toolkit (GWT)
 

Recently uploaded

JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
Alluxio, Inc.
 

Recently uploaded (20)

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring Software
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data Migration
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 

Git for developers

  • 2. Hacen Dadda ◉ Web Developer ◉ Consultant ◉ CTO @ @hacentech hdadda@hivedigit.com http://about.me/hacen
  • 7. A 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. Even though the examples in this book show software source code as the files under version control, in reality any type of file on a computer can be placed under version control.
  • 8. WHAT IS GIT ? In 2005, the Linux development community (and in particular Linus Torvalds) develop their own tool based on some of the lessons they learned while using BitKeeper. Some of the goals of the new system were as follows: ◉ Speed ◉ Simple design ◉ Strong support for non-linear development ◉ Fully distributed ◉ Able to handle large projects
  • 9. WHY GIT ? Distributed
  • 11. BIG project ? The linux kernel 3.13 release ◉ + 15 million line of code ◉ 12 000 non-megre commits ( non accepted code ) ◉ 446K lines of code added ◉ 1 339 contributors
  • 12. INSTALLING GIT ◉ Linux (Ubuntu) sudo apt-get install git-all Or sudo dpkg -i git_***.deb ◉ Windows https://git-scm.com/download/win ◉ Mac https://git-scm.com/download/mac
  • 13. Git Configuration git config --global user.name "John Doe" git config --global user.email johndoe@example.com
  • 14. create a new repository create a new directory, open it and perform a git init to create a new git repository.
  • 15. checkout a repository create a working copy of a local repository by running the command git clone /path/to/repository when using a remote server, your command will be git clone username@host:/path/to/repository
  • 16. 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.
  • 18. add & commit You can propose changes (add it to the Index) using git add <filename> git add . 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.
  • 19. log in its simplest form, you can study repository history using.. git log You can add a lot of parameters to make the log look like what you want. To see a very compressed log where each commit is one line: git log --pretty=oneline Or maybe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches: git log --graph --oneline --decorate --all
  • 21. Tools
  • 22. 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 not cloned an existing repository and want to connect your repository to a remote server, you need to add it with git remote add origin <server> Now you are able to push your changes to the selected remote server
  • 23. update & merge to update your local repository to the newest commit, execute git pull origin master in your working directory to fetch and merge remote changes.
  • 24. 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.
  • 25. branching create a new branch named "feature_x" and switch to it using git checkout -b feature_x switch back to master git checkout master and delete the branch again git branch -d feature_x
  • 26. Create a new branch git checkout -b some_feature
  • 27. branching to merge another branch into your active branch (e.g. master), use git merge <branch> in both cases 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.
  • 28. Merge a branch git checkout master git merge some_feature
  • 34. Workflow (Branching model) Read: A successful Git branching model By: Vincent Driessen