SlideShare une entreprise Scribd logo
1  sur  17
Git (and github) for stand alone use
Ikuru K
What is git?
● A better version control system
● Freely available and open source
● What are version control systems good for?
Google it!
Brief history
● Linux project was initially using the bit keeper service, but
one of the contributors reverse engineered the protocol,
and made the provider angry, and Linux project got
banned from using the service.
● Linux's original author decided to make a version control
system that scales up with the project size, that also works
in a distributed manner.
● Linux original author passed the maintainer role to another
developer, and git has been evolving since.
Version control jargons
● Fluffy concept, but used frequently.
● Definitions are subjective, so feedback is
appreciated.
● Checkout/branch, commit, push, pull/merge.
Checkout/branch
● Point where change starts to be made
● Implication that it is always possible to return to
the checkout point, in case of some code
breakage that is not possible to recover.
Git repository, index, and
workspace.
● Changes made to your files exist in the
workspace.
● git add will move those changes to the index.
● Committing those changes will move whats in
the index to the repository object store.
● This three phase system allows the messy part
of the scratching prettier, and less garbage gets
committed as a result.
Commit
● In git context, a commit is a set of changes made to
the code base.
– More than a simple “save”
● Granularity is often subject of discussion
– If too much is changed in a single commit, then there is not
much point of it.
– If related changes are scattered across multiple commits,
life will be hard.
– Seems like work possible to be described in one sentence
is a good rule of thumb
Push
● Reflect the changes made by you to some
other entity. i.e. publish your commits
– Remote repository/ other person
– “Change made today will be pushed to production”
– “Please don't push garbage to our repository”
Pull
● Incorporate changes to a domain you have
control.
– If working on a local version of famous project
(MySql for instance), frequently pull changes.
Getting git on your machine
● For debian/ubuntu, $sudo apt-get install git
● For rhel/centos, look into yum
● For Windows and mac, respective clients are
available.
● (Google will explain this better)
Starting Project
● Create empty directory on file system
● Run $ git init
● Files and directories for git use will be created,
and git will track changes made to files created
in the file structure.
First commit ever
● Write a file, save.
● $ git status
– Will show files modified since last commit
● $ git diff
– Show line by line detail of the change since last commit.
● $ git add <filename>
– Tell git that file is ready to commit
● $ git commit -m “commit message”
– Officially commits the change
Too much has been modified since last commit,
and a simple commit msg cannot describe what
has been done?
● $ git add –patch <filename>
– Can interactively split up what gets staged to be
committed
Check what is to be committed
● $git commit -v
– Editor will open with detail of the commit detail.
– Write message and commit.
git rm --cached file.txt
● Use when you want to remove a file from the
repository, but want to keep in the file system.
● Also add such file to .gitignore file.
Remote/Github linkage
● All is lost if your PC blows, so remote repo is a
good idea.
● $git remote add origin <url of repository>
– Tells git where to push commits
● $git push origin master
– Push the commits to the remote repository
–
Checkout for stand alone use
● $git checkout <filename>
– Discard changes made since latest commit
– Good when you know program was working at the time when
latest commit was made
● $git checkout -b <branch name>
– Commits made after this will not affect the master branch
– The best habit is to always work on branches, and merge the
work from the master
– i.e. $git checkout master, followed by
$git merge <branch name>

Contenu connexe

Tendances

Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan Maulana
 

Tendances (20)

Github
GithubGithub
Github
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Git slides
Git slidesGit slides
Git slides
 
Github
GithubGithub
Github
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Brush up on using github
Brush up on using githubBrush up on using github
Brush up on using github
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git & git hub
Git & git hubGit & git hub
Git & git hub
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 

Similaire à Git for standalone use

Similaire à Git for standalone use (20)

Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git basics
Git basicsGit basics
Git basics
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git and github
Git and githubGit and github
Git and github
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primer
 
Git Mastery
Git MasteryGit Mastery
Git Mastery
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
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
 
Git&GitHub.pptx
Git&GitHub.pptxGit&GitHub.pptx
Git&GitHub.pptx
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git workshop
Git workshopGit workshop
Git workshop
 
An introductory guide to GIT
An introductory guide to GITAn introductory guide to GIT
An introductory guide to GIT
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 

Plus de Ikuru Kanuma

Plus de Ikuru Kanuma (20)

clj and deps.edn
clj and deps.ednclj and deps.edn
clj and deps.edn
 
Kukutei shinkoku with Clojure
Kukutei shinkoku with ClojureKukutei shinkoku with Clojure
Kukutei shinkoku with Clojure
 
Locarise,reagent and JavaScript Libraries
Locarise,reagent and JavaScript LibrariesLocarise,reagent and JavaScript Libraries
Locarise,reagent and JavaScript Libraries
 
clara-rules
clara-rulesclara-rules
clara-rules
 
ClojureScript@node
ClojureScript@nodeClojureScript@node
ClojureScript@node
 
Welcome to ClojureScript
Welcome to ClojureScriptWelcome to ClojureScript
Welcome to ClojureScript
 
Clojure web dev history
Clojure web dev historyClojure web dev history
Clojure web dev history
 
Arachne Unweaved (JP)
Arachne Unweaved (JP)Arachne Unweaved (JP)
Arachne Unweaved (JP)
 
Clojureでガラケーサイトを作る際の細かい話
Clojureでガラケーサイトを作る際の細かい話Clojureでガラケーサイトを作る際の細かい話
Clojureでガラケーサイトを作る際の細かい話
 
Web forms made easy (with formative)
Web forms made easy (with formative)Web forms made easy (with formative)
Web forms made easy (with formative)
 
サムネイルを作る話
サムネイルを作る話サムネイルを作る話
サムネイルを作る話
 
Review June2015 Dec2015
Review June2015 Dec2015Review June2015 Dec2015
Review June2015 Dec2015
 
Redmine on amazon ec2
Redmine on amazon ec2Redmine on amazon ec2
Redmine on amazon ec2
 
Engineering Ethics (In Japanese)
Engineering Ethics (In Japanese)Engineering Ethics (In Japanese)
Engineering Ethics (In Japanese)
 
First Real Pull Request Ever
First Real Pull Request EverFirst Real Pull Request Ever
First Real Pull Request Ever
 
Pyunit
PyunitPyunit
Pyunit
 
Review june2014 june2015
Review june2014 june2015Review june2014 june2015
Review june2014 june2015
 
Elementary vim tricks
Elementary vim tricksElementary vim tricks
Elementary vim tricks
 
Processors in a nutshell
Processors in a nutshellProcessors in a nutshell
Processors in a nutshell
 
Computer hardware, and network
Computer hardware, and networkComputer hardware, and network
Computer hardware, and network
 

Dernier

KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
Cara Menggugurkan Kandungan 087776558899
 
February 2024 Recommendations for newsletter
February 2024 Recommendations for newsletterFebruary 2024 Recommendations for newsletter
February 2024 Recommendations for newsletter
ssuserdfec6a
 
the Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentationthe Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentation
brynpueblos04
 
Girls in Mahipalpur (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Mahipalpur  (delhi) call me [🔝9953056974🔝] escort service 24X7Girls in Mahipalpur  (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Mahipalpur (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (15)

Dadar West Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Dadar West Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsDadar West Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Dadar West Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
Colaba Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Colaba Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsColaba Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Colaba Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
 
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
 
2023 - Between Philosophy and Practice: Introducing Yoga
2023 - Between Philosophy and Practice: Introducing Yoga2023 - Between Philosophy and Practice: Introducing Yoga
2023 - Between Philosophy and Practice: Introducing Yoga
 
SIKP311 Sikolohiyang Pilipino - Ginhawa.pptx
SIKP311 Sikolohiyang Pilipino - Ginhawa.pptxSIKP311 Sikolohiyang Pilipino - Ginhawa.pptx
SIKP311 Sikolohiyang Pilipino - Ginhawa.pptx
 
February 2024 Recommendations for newsletter
February 2024 Recommendations for newsletterFebruary 2024 Recommendations for newsletter
February 2024 Recommendations for newsletter
 
the Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentationthe Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentation
 
Girls in Mahipalpur (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Mahipalpur  (delhi) call me [🔝9953056974🔝] escort service 24X7Girls in Mahipalpur  (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Mahipalpur (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Emotional Freedom Technique Tapping Points Diagram.pdf
Emotional Freedom Technique Tapping Points Diagram.pdfEmotional Freedom Technique Tapping Points Diagram.pdf
Emotional Freedom Technique Tapping Points Diagram.pdf
 
March 2023 Recommendations for newsletter
March 2023 Recommendations for newsletterMarch 2023 Recommendations for newsletter
March 2023 Recommendations for newsletter
 
Social Learning Theory presentation.pptx
Social Learning Theory presentation.pptxSocial Learning Theory presentation.pptx
Social Learning Theory presentation.pptx
 
Call Girls In Mumbai Just Genuine Call ☎ 7738596112✅ Call Girl Andheri East G...
Call Girls In Mumbai Just Genuine Call ☎ 7738596112✅ Call Girl Andheri East G...Call Girls In Mumbai Just Genuine Call ☎ 7738596112✅ Call Girl Andheri East G...
Call Girls In Mumbai Just Genuine Call ☎ 7738596112✅ Call Girl Andheri East G...
 
Exploring Stoic Philosophy From Ancient Wisdom to Modern Relevance.pdf
Exploring Stoic Philosophy From Ancient Wisdom to Modern Relevance.pdfExploring Stoic Philosophy From Ancient Wisdom to Modern Relevance.pdf
Exploring Stoic Philosophy From Ancient Wisdom to Modern Relevance.pdf
 
Goregaon West Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Goregaon West Escorts 🥰 8617370543 Call Girls Offer VIP Hot GirlsGoregaon West Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
Goregaon West Escorts 🥰 8617370543 Call Girls Offer VIP Hot Girls
 

Git for standalone use

  • 1. Git (and github) for stand alone use Ikuru K
  • 2. What is git? ● A better version control system ● Freely available and open source ● What are version control systems good for? Google it!
  • 3. Brief history ● Linux project was initially using the bit keeper service, but one of the contributors reverse engineered the protocol, and made the provider angry, and Linux project got banned from using the service. ● Linux's original author decided to make a version control system that scales up with the project size, that also works in a distributed manner. ● Linux original author passed the maintainer role to another developer, and git has been evolving since.
  • 4. Version control jargons ● Fluffy concept, but used frequently. ● Definitions are subjective, so feedback is appreciated. ● Checkout/branch, commit, push, pull/merge.
  • 5. Checkout/branch ● Point where change starts to be made ● Implication that it is always possible to return to the checkout point, in case of some code breakage that is not possible to recover.
  • 6. Git repository, index, and workspace. ● Changes made to your files exist in the workspace. ● git add will move those changes to the index. ● Committing those changes will move whats in the index to the repository object store. ● This three phase system allows the messy part of the scratching prettier, and less garbage gets committed as a result.
  • 7. Commit ● In git context, a commit is a set of changes made to the code base. – More than a simple “save” ● Granularity is often subject of discussion – If too much is changed in a single commit, then there is not much point of it. – If related changes are scattered across multiple commits, life will be hard. – Seems like work possible to be described in one sentence is a good rule of thumb
  • 8. Push ● Reflect the changes made by you to some other entity. i.e. publish your commits – Remote repository/ other person – “Change made today will be pushed to production” – “Please don't push garbage to our repository”
  • 9. Pull ● Incorporate changes to a domain you have control. – If working on a local version of famous project (MySql for instance), frequently pull changes.
  • 10. Getting git on your machine ● For debian/ubuntu, $sudo apt-get install git ● For rhel/centos, look into yum ● For Windows and mac, respective clients are available. ● (Google will explain this better)
  • 11. Starting Project ● Create empty directory on file system ● Run $ git init ● Files and directories for git use will be created, and git will track changes made to files created in the file structure.
  • 12. First commit ever ● Write a file, save. ● $ git status – Will show files modified since last commit ● $ git diff – Show line by line detail of the change since last commit. ● $ git add <filename> – Tell git that file is ready to commit ● $ git commit -m “commit message” – Officially commits the change
  • 13. Too much has been modified since last commit, and a simple commit msg cannot describe what has been done? ● $ git add –patch <filename> – Can interactively split up what gets staged to be committed
  • 14. Check what is to be committed ● $git commit -v – Editor will open with detail of the commit detail. – Write message and commit.
  • 15. git rm --cached file.txt ● Use when you want to remove a file from the repository, but want to keep in the file system. ● Also add such file to .gitignore file.
  • 16. Remote/Github linkage ● All is lost if your PC blows, so remote repo is a good idea. ● $git remote add origin <url of repository> – Tells git where to push commits ● $git push origin master – Push the commits to the remote repository –
  • 17. Checkout for stand alone use ● $git checkout <filename> – Discard changes made since latest commit – Good when you know program was working at the time when latest commit was made ● $git checkout -b <branch name> – Commits made after this will not affect the master branch – The best habit is to always work on branches, and merge the work from the master – i.e. $git checkout master, followed by $git merge <branch name>