SlideShare a Scribd company logo
Git Workshop
by Kugathasan Abimaran
Getting Git
Why Version Control?
• Made a change to code, realized it was a mistake and wanted
to go back?
• You don't lose anything.
• I never again commented out code, I simply delete it
• Working as a Team..?
• Wanted to experiment new feature without affecting working
code?
• What did I do yesterday?
• Wanted Copy of Copy of Copy of Project?
Git
• A directory content management system
• Download & Install
– http://msysgit.github.com/
• git help
• git <command> -h
• $HOME/.gitconfig
– git config --global user.name “Kugathasan Abimaran"
– git config --global user.email development@domain51.com
– git config --global color.ui true
GitHub
• Build Software Better and Together.
• Create a GitHub account
• Install GitHub for Windows from here
– http://github-
windows.s3.amazonaws.com/GitHubSetup.exe
• World largest open source community
• Create own repository
• Work on your dream project..?
Create/Clone
• Create a git repository
– git init
• Obtains a copy of a project for you with entire
history
• Valid URLs are project directory names by
various protocols
– git clone git@github.com:abi-maran/demo.git
– git clone https://github.com/abi-maran/demo.git
• Clone the repository from
https://github.com/abi-maran/demo
Commit
• Git uses two-step process to get changes into
the repository.
– Staging changes adds it to index or staging area.
– Commit
Commit …
• Each commit needs a commit message.
• Git don’t track empty directories
• git status
Fix/Revert Commit
• Change last commit
– git commit –amend
• Unmodify modified file
– git checkout -- file.py
• Git revert <commit-id>
• By creating new commit that reverse the
commit
Differences
• git diff – changes between index and working
files
• git diff HEAD
• git diff --stat
• git diff $commit $commit
• git log
Pull/Push to Repo
• git pull <remote> <rbranch>
• git push <remote> <rbranch>
Ignoring Files
• For the which you don’t want to add in git
repo forever!
• .gitignore file – a project specific file
• .git/info/excludes – global
Stashing
• To save uncommitted files and return clean
repo
– git stash “description”
– Do that work
– git stash apply
Branch
• Master is the default branch
• git branch –l / -r / -a
• Create a branch
– git branch name
• git checkout branch
Merge Branches
• To share changes between branches
• Fast-forward merge
• Recursively merge
• Cherry-pick
Conflicts
• When both changes the same line of code
<<<<<<< HEAD
def _handle_response(self, response, data=[], raw=False):
return data if raw else simplejson.loads(data)
=======
def _handle_response(self, response, raw=False, data=[]):
if raw:
return data
return simplejson.loads(data)
>>>>>>> added_raw
git merge tool
Tag
• To mark milestones in your project such as
releases.
• Read only
GUI/References
• Gitk – for Linux
• Git Extentions – For Windows
• Home Page : http://www.git-scm.com/
• Reference : http://gitref.org/
For more information
General
Careers
Web
: info@hsenidmobile.com
: careers@hsenidmobile.com
: www.hSenidMobile.com

More Related Content

What's hot

Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash course
Mireia Sangalo
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
GDSCIIITBbsr
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
Jiwon Baek
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Md Atique Ahmed Ziad
 
Git 101
Git 101Git 101
Git 101
Sachet Mittal
 
Library Carpentry Git, GitHub and GitPages Introduction Slides
Library Carpentry Git, GitHub and GitPages Introduction SlidesLibrary Carpentry Git, GitHub and GitPages Introduction Slides
Library Carpentry Git, GitHub and GitPages Introduction Slides
Sarah Anna Stewart
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
GoogleDevelopersStud1
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
LearningTech
 
Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2
Omar Fathy
 
Git basics
Git basicsGit basics
Git basics
Ashwin Date
 
Git theory
Git   theoryGit   theory
Git theory
hariprasad1035
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Github
GithubGithub
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
Suhas Shivaram
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
Omar Fathy
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Roland Emmanuel Salunga
 
Git-r-Done
Git-r-DoneGit-r-Done
Git-r-Done
Cesar Martinez
 
GitHub Talk - Cody Carnachan
GitHub Talk - Cody CarnachanGitHub Talk - Cody Carnachan
GitHub Talk - Cody Carnachan
Cody Carnachan
 

What's hot (20)

Git and GitHub crash course
Git and GitHub crash courseGit and GitHub crash course
Git and GitHub crash course
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git 101
Git 101Git 101
Git 101
 
Library Carpentry Git, GitHub and GitPages Introduction Slides
Library Carpentry Git, GitHub and GitPages Introduction SlidesLibrary Carpentry Git, GitHub and GitPages Introduction Slides
Library Carpentry Git, GitHub and GitPages Introduction Slides
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
 
Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2Introduction to Git and GitHub Part 2
Introduction to Git and GitHub Part 2
 
Git basics
Git basicsGit basics
Git basics
 
Git theory
Git   theoryGit   theory
Git theory
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Github
GithubGithub
Github
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git-r-Done
Git-r-DoneGit-r-Done
Git-r-Done
 
GitHub Talk - Cody Carnachan
GitHub Talk - Cody CarnachanGitHub Talk - Cody Carnachan
GitHub Talk - Cody Carnachan
 

Similar to Git workshop - University of Moratuwa, Department of Computer Science and Engineering

Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar
 
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
 
Introduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptxIntroduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
dropsolid
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
gdsc13
 
11 git version control
11 git version control11 git version control
11 git version control
Wasim Alatrash
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
Muhil Vannan
 
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
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Git basic
Git basicGit basic
Git basic
Emran Ul Hadi
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
Geoff Hoffman
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
Serhii Kartashov
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
Pablo Quiroga
 

Similar to Git workshop - University of Moratuwa, Department of Computer Science and Engineering (20)

Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
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
 
Introduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptxIntroduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptx
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
11 git version control
11 git version control11 git version control
11 git version control
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
 
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
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git basic
Git basicGit basic
Git basic
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 

Recently uploaded

Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
Paul Brebner
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
seospiralmantra
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 

Recently uploaded (20)

Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 

Git workshop - University of Moratuwa, Department of Computer Science and Engineering

  • 3. Why Version Control? • Made a change to code, realized it was a mistake and wanted to go back? • You don't lose anything. • I never again commented out code, I simply delete it • Working as a Team..? • Wanted to experiment new feature without affecting working code? • What did I do yesterday? • Wanted Copy of Copy of Copy of Project?
  • 4. Git • A directory content management system • Download & Install – http://msysgit.github.com/ • git help • git <command> -h • $HOME/.gitconfig – git config --global user.name “Kugathasan Abimaran" – git config --global user.email development@domain51.com – git config --global color.ui true
  • 5. GitHub • Build Software Better and Together. • Create a GitHub account • Install GitHub for Windows from here – http://github- windows.s3.amazonaws.com/GitHubSetup.exe • World largest open source community • Create own repository • Work on your dream project..?
  • 6. Create/Clone • Create a git repository – git init • Obtains a copy of a project for you with entire history • Valid URLs are project directory names by various protocols – git clone git@github.com:abi-maran/demo.git – git clone https://github.com/abi-maran/demo.git • Clone the repository from https://github.com/abi-maran/demo
  • 7. Commit • Git uses two-step process to get changes into the repository. – Staging changes adds it to index or staging area. – Commit
  • 8. Commit … • Each commit needs a commit message. • Git don’t track empty directories • git status
  • 9. Fix/Revert Commit • Change last commit – git commit –amend • Unmodify modified file – git checkout -- file.py • Git revert <commit-id> • By creating new commit that reverse the commit
  • 10. Differences • git diff – changes between index and working files • git diff HEAD • git diff --stat • git diff $commit $commit • git log
  • 11. Pull/Push to Repo • git pull <remote> <rbranch> • git push <remote> <rbranch>
  • 12. Ignoring Files • For the which you don’t want to add in git repo forever! • .gitignore file – a project specific file • .git/info/excludes – global
  • 13. Stashing • To save uncommitted files and return clean repo – git stash “description” – Do that work – git stash apply
  • 14. Branch • Master is the default branch • git branch –l / -r / -a • Create a branch – git branch name • git checkout branch
  • 15. Merge Branches • To share changes between branches • Fast-forward merge • Recursively merge • Cherry-pick
  • 16. Conflicts • When both changes the same line of code <<<<<<< HEAD def _handle_response(self, response, data=[], raw=False): return data if raw else simplejson.loads(data) ======= def _handle_response(self, response, raw=False, data=[]): if raw: return data return simplejson.loads(data) >>>>>>> added_raw git merge tool
  • 17. Tag • To mark milestones in your project such as releases. • Read only
  • 18. GUI/References • Gitk – for Linux • Git Extentions – For Windows • Home Page : http://www.git-scm.com/ • Reference : http://gitref.org/
  • 19. For more information General Careers Web : info@hsenidmobile.com : careers@hsenidmobile.com : www.hSenidMobile.com