SlideShare a Scribd company logo
Git in 10 minutes 
- eliminate confusions
Content 
● What is git? - 30 seconds 
● How it works? - 2 minutes 
● Github flow - 3 minutes 
● Frequently Used Commands - 2 minutes 
● Confusions on Undo- 2 minutes 
● Useful links - 30 seconds
Git 
● Distributed version control system 
Although git allows to have multiple remote repositories, usually we maintain only one remote 
repository, that is ‘origin’. 
Associated command: git remote -v
Git
How it works 
Nearly all operations are local. 
- git branch 
- git checkout 
- git status 
- git commit 
- git merge 
Remote operations 
- git pull (Actually: git fetch + git merge) 
- git push
How it works
Github flow 
1.Create branch 2.Commit 3.Pull request 4.Commit 5. Merge to master
Github flow & our toppings 
1. Create branch 
git checkout master 
git pull 
git checkout -b feature1 
2.Commit 
git add filename.php 
git commit 
git push -u origin feature1 
3. Pull request : Not directly connected to git operation 
4.Commit 
git add filename.php 
git commit 
git push 
5.Merge to master 
git checkout master 
git pull 
git merge feature1 
git push
Frequently Used Commands 
● If you have done so many unnecessary changes in different files and now you want to discard all the changes ( before 
working at cool mind ) : 
git reset --hard 
● Another most used command that is very useful when did commit but that was a mistake. What will you do? 
If you want to remove your last commit that has not been pushed yet: 
git reset --hard HEAD^ 
● To view unpushed git commits 
git log origin/master..HEAD 
● To create a local branch that will track remote branch 
git checkout -t origin/branchname 
● To see all commits of someone 
git log --author=Jon 
● To see all commits since last 2 weeks 
git log --since=2.weeks 
● To see the diff of a file which has already been added to stage 
git diff --cached example.txt
Confusions 
Undo: 
Action Command Output 
M git checkout filename - 
M > S git reset HEAD filename M 
M > S > C git reset --soft HEAD^ S 
M > S > C git reset --mixed HEAD^ M 
M > S > C git reset --hard HEAD^ - 
M > S > C > P git reset --hard HEAD^ 
git push -f origin branch-name 
- 
M = Modified 
S = Staged 
C = Committed 
P = Pushed
Confusions 
Undo: 
Delete local branch: git branch -d branch-name 
Delete remote branch: git push origin --delete branch-name 
git cherry 
git checkout production_branch 
git cherry dev_branch 
git cherry-pick 62ecb3
Useful links 
● http://git-scm.com/book/en/v2 
● http://rogerdudler.github.io/git-guide/ 
● https://www.codeschool.com/courses/try-git 
● http://www.pranjol.com/blog/66 
● stackoverflow and google :)
Thank you
Ad

More Related Content

What's hot (20)

Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Somkiat Puisungnoen
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
Mohammad Imam Hossain
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
Arnaud Seilles
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
Pham Quy (Jack)
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Git basic
Git basicGit basic
Git basic
Emran Ul Hadi
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
PravallikaTammisetty
 
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
GitGit
Git
Gayan Kalanamith Mannapperuma
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
Sergiu-Ioan Ungur
 

Similar to Git in 10 minutes (20)

Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
seungzzang Kim
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
razasayed
 
Git
GitGit
Git
Parag Gupta
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Andy Slocum
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
Christoph Matthies
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
Javier Lafora Rey
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
Rakesh Jha
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
vimukthirandika
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
Susan Tan
 
Git cheat-sheet
Git cheat-sheetGit cheat-sheet
Git cheat-sheet
MarcoRodas9
 
Git cheat-sheet 2021
Git cheat-sheet 2021Git cheat-sheet 2021
Git cheat-sheet 2021
Rana Faisal Haroon
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With Git
Hoffman Lab
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
Yoram Michaeli
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
Piotr Benetkiewicz
 
Git
GitGit
Git
Terry Wang
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
Tagged Social
 
Ad

Recently uploaded (20)

TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Ad

Git in 10 minutes

  • 1. Git in 10 minutes - eliminate confusions
  • 2. Content ● What is git? - 30 seconds ● How it works? - 2 minutes ● Github flow - 3 minutes ● Frequently Used Commands - 2 minutes ● Confusions on Undo- 2 minutes ● Useful links - 30 seconds
  • 3. Git ● Distributed version control system Although git allows to have multiple remote repositories, usually we maintain only one remote repository, that is ‘origin’. Associated command: git remote -v
  • 4. Git
  • 5. How it works Nearly all operations are local. - git branch - git checkout - git status - git commit - git merge Remote operations - git pull (Actually: git fetch + git merge) - git push
  • 7. Github flow 1.Create branch 2.Commit 3.Pull request 4.Commit 5. Merge to master
  • 8. Github flow & our toppings 1. Create branch git checkout master git pull git checkout -b feature1 2.Commit git add filename.php git commit git push -u origin feature1 3. Pull request : Not directly connected to git operation 4.Commit git add filename.php git commit git push 5.Merge to master git checkout master git pull git merge feature1 git push
  • 9. Frequently Used Commands ● If you have done so many unnecessary changes in different files and now you want to discard all the changes ( before working at cool mind ) : git reset --hard ● Another most used command that is very useful when did commit but that was a mistake. What will you do? If you want to remove your last commit that has not been pushed yet: git reset --hard HEAD^ ● To view unpushed git commits git log origin/master..HEAD ● To create a local branch that will track remote branch git checkout -t origin/branchname ● To see all commits of someone git log --author=Jon ● To see all commits since last 2 weeks git log --since=2.weeks ● To see the diff of a file which has already been added to stage git diff --cached example.txt
  • 10. Confusions Undo: Action Command Output M git checkout filename - M > S git reset HEAD filename M M > S > C git reset --soft HEAD^ S M > S > C git reset --mixed HEAD^ M M > S > C git reset --hard HEAD^ - M > S > C > P git reset --hard HEAD^ git push -f origin branch-name - M = Modified S = Staged C = Committed P = Pushed
  • 11. Confusions Undo: Delete local branch: git branch -d branch-name Delete remote branch: git push origin --delete branch-name git cherry git checkout production_branch git cherry dev_branch git cherry-pick 62ecb3
  • 12. Useful links ● http://git-scm.com/book/en/v2 ● http://rogerdudler.github.io/git-guide/ ● https://www.codeschool.com/courses/try-git ● http://www.pranjol.com/blog/66 ● stackoverflow and google :)