SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
Git & Github
workshop
Agenda
Git basics
- File status lifecycle
- Staging and committing
- Undoing things
Distributed Git & Github I
- Basic workflow (fork, commit, pull request)
Branching
- Creating and switching branches
- Merging
- Rebasing
Distributed Git & Github II
- Distributed workflow
- Synchronising with upstream
and resolving conflicts
Git basics
$ git init
Git basics - file status lifecycle
$ git status
untracked unmodified modified staged
add the file
edit the file
stage the file
remove the file
commit
Git basics - staging and committing
Stage file and track untracked files
$ git add <file name | wildcard>
Remove and stage file removal
$ git rm <file name | wildcard>
Commit staged changes
$ git commit -m “<message>”
Git basics - staging and commiting
$ cat .gitignore
tmp/ # ignore all files in tmp dir
logs/*.log # all files in logs dir with .log
*.tmp # all files with .tmp ext
Git basics - staging and commiting
Show unstaged changes
$ git diff
Show staged changes
$ git diff --cached
Git basics - staging and commiting
Show all commits with authors, dates and
descriptions
$ git log
Show all commits with complete diff
$ git log -p
Show all commits with additions/deletions
stats
$ git log --stat
Git basics - undoing things
Change last commit
$ git commit --amend
Unstage changes in given file
$ git reset HEAD <file name>
Revert unstaged changes in given file
$ git checkout -- <file name>
Git basics - distributed Git & Github I
blessed repository
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
fork
fork
fork
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
private
developer
private
developer
private
clone clone clone
commit
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
private
developer
private
developer
private
push
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
private
developer
private
developer
private
pull request
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
private
developer
private
developer
private
review pull request & merge
Git basics - distributed Git & Github I
$ git clone <url>
$ git push <remote> <branch>
Git basics - Creating and switching
branches
Create branch
$ git branch <name>
Activate branch
$ git checkout <name>
Remove branch
$ git branch -d <name>
Git basics - Creating and switching
branches
Merge changes from branch <branch> to
selected branch
$ git merge <branch>
c0
b1 c1
c2b2
c3
branch
commit
merge
Git basics - Creating and switching
branches
Rebase changes from branch <branch> to given
branch
$ git rebase <branch>
c0
b1 c1
c2b2
branch
commit
c0
b1 c1
c2
b2
branch
commit
c1
c2
rebase

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Git advanced
Git advancedGit advanced
Git advanced
 
Get Familiar With Git
Get Familiar With Git Get Familiar With Git
Get Familiar With Git
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Git in pills : git stash
Git in pills : git stashGit in pills : git stash
Git in pills : git stash
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With Git
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
 
Git slides
Git slidesGit slides
Git slides
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
git internals
git internalsgit internals
git internals
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
 
GIT from n00b
GIT from n00bGIT from n00b
GIT from n00b
 
Git Cards - Powerpoint Format
Git Cards - Powerpoint FormatGit Cards - Powerpoint Format
Git Cards - Powerpoint Format
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Atlanta Pm Git 101
Atlanta Pm Git 101Atlanta Pm Git 101
Atlanta Pm Git 101
 
Git basic and workflow
Git basic and workflowGit basic and workflow
Git basic and workflow
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Git basics
Git basicsGit basics
Git basics
 

Semelhante a Brainly git basics workshop

Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmdsrinathcox
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheetjaehyok Song
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubDSC GVP
 
Git training cheat sheet
Git training cheat sheetGit training cheat sheet
Git training cheat sheetSkander Hamza
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucketazwildcat
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Ashok Kumar
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 

Semelhante a Brainly git basics workshop (20)

Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Gittalk
GittalkGittalk
Gittalk
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Git training cheat sheet
Git training cheat sheetGit training cheat sheet
Git training cheat sheet
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
 
Git cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdfGit cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdf
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Git
GitGit
Git
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 

Último

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Último (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Brainly git basics workshop

  • 2. Agenda Git basics - File status lifecycle - Staging and committing - Undoing things Distributed Git & Github I - Basic workflow (fork, commit, pull request) Branching - Creating and switching branches - Merging - Rebasing Distributed Git & Github II - Distributed workflow - Synchronising with upstream and resolving conflicts
  • 4. Git basics - file status lifecycle $ git status untracked unmodified modified staged add the file edit the file stage the file remove the file commit
  • 5. Git basics - staging and committing Stage file and track untracked files $ git add <file name | wildcard> Remove and stage file removal $ git rm <file name | wildcard> Commit staged changes $ git commit -m “<message>”
  • 6. Git basics - staging and commiting $ cat .gitignore tmp/ # ignore all files in tmp dir logs/*.log # all files in logs dir with .log *.tmp # all files with .tmp ext
  • 7. Git basics - staging and commiting Show unstaged changes $ git diff Show staged changes $ git diff --cached
  • 8. Git basics - staging and commiting Show all commits with authors, dates and descriptions $ git log Show all commits with complete diff $ git log -p Show all commits with additions/deletions stats $ git log --stat
  • 9. Git basics - undoing things Change last commit $ git commit --amend Unstage changes in given file $ git reset HEAD <file name> Revert unstaged changes in given file $ git checkout -- <file name>
  • 10. Git basics - distributed Git & Github I blessed repository
  • 11. Git basics - distributed Git & Github I blessed repository developer public developer public developer public fork fork fork
  • 12. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private clone clone clone commit
  • 13. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private push
  • 14. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private pull request
  • 15. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private review pull request & merge
  • 16. Git basics - distributed Git & Github I $ git clone <url> $ git push <remote> <branch>
  • 17. Git basics - Creating and switching branches Create branch $ git branch <name> Activate branch $ git checkout <name> Remove branch $ git branch -d <name>
  • 18. Git basics - Creating and switching branches Merge changes from branch <branch> to selected branch $ git merge <branch> c0 b1 c1 c2b2 c3 branch commit merge
  • 19. Git basics - Creating and switching branches Rebase changes from branch <branch> to given branch $ git rebase <branch> c0 b1 c1 c2b2 branch commit c0 b1 c1 c2 b2 branch commit c1 c2 rebase