SlideShare ist ein Scribd-Unternehmen logo
1 von 24
INTRODUCTION TO GIT AND GITHUB
ATIQUE AHMED ZIAD
LEAD DEVELOPER, LEGALX LTD.
MOZILLA REPRESENTATIVE
LET’S DISCUSS SOME ISSUES…
 Can not work parallelly.
 No version controlling.
 Wrestling with bugs.
 Revision is not made easy.
WHAT IS GIT AND GITHUB
“Git is a free and open source distributed version control system
designed to handle everything from small to very large projects
with speed and efficiency.”
“GitHub is a cloud based platform built around the Git tool. It is an
online service that stores code pushed to it from computers
running the Git tool. It offers all of the distributed version control
and source code management functionality of Git as well as adding
its own features.”
A SHORT STORY OF GIT
In 2002, the Linux kernel project began using a proprietary DVCS
called BitKeeper
In 2005, BitKeeper’s free-of-charge status was revoked.
This prompted the Linux development community (and in
particular Linus Torvalds, the creator of Linux) to develop their
own tool.
This gave birth to Git in 2005. It’s amazingly fast, very efficient
with large projects, and it has an incredible branching system for
non-linear development
INSTALLATION OF GIT
 Download Git from https://git-scm.com/downloads
 Downloaded ? Time to install it !
 Verify Git installation.
Git Config
Username config:
Email config:
$ git config --global user.name yourusername
$ git config --global user.email youremail@example.com
$ git
MAKE YOUR FIRST REPOSITORY IN GITHUB
 Open a new repository in Github.
 Choose / create a directory with some files inside it.
Follow the below commands in Terminal / CMD:
This will initialize Git in the directory. A folder named .git has been
created.
The git status command displays the state of the working directory and
the staging area.
$ git init
$ git status
MAKE YOUR FIRST REPOSITORY IN GITHUB
$ git add .
$ git commit –m “commit title”
$ git remote add origin <REMOTE_URL>
$ git push –u origin master
Git add all files
Commit the added files
Set remote repository url (if not set previously)
Push to remote repository
Checkout remote urls
$ git remote -v
CONGRATULATION !
YOU HAVE UPLOADED YOUR FIRST
GIT REPOSITORY.
GIT WORKFLOW
RECORDING CHANGES TO THE REPOSITORY
GIT COMMIT
• A commit in a git repository records a snapshot of all the
files in your directory. It's like a giant copy and paste, but
even better!
• A commit takes all staged changes into it.
$ git commit –m “commit title”
VIEWING COMMIT HISTORY
$ git log
VIEW LOG WITH PATCH AND LAST ENTRIES
$ git log –p -1
-p stands for patch which shows the differences in each commit
-1 used for showing only last one commit
POINTER & HEAD
When you make a commit, Git stores a commit object that contains a pointer
to the snapshot of the content you staged.
How does Git know what branch you’re currently on? It keeps a special pointer
called HEAD.
GIT BRANCHES
Branching means you diverge from the main line of development
and continue to do work without messing with that main line.
• Branches in git are incredibly lightweight.
• They are simply pointers to a specific commit -- nothing more.
• “Killer Feature” of git.
GIT CREATING NEW BRANCH
$ git branch <branch_name>
Here the new branch name is testing
GIT BRANCHES COMMANDS
$ git checkout –b <branch_name>
Opening a new branch and switching to that branch
$ git checkout –d <branch_name>
Deleting a local branch
$ git push <remote_name> –d <branch_name>
Deleting a remote branch
$ git checkout <branch_name>
Switching to a branch
$ git branch
See all branches
GIT MERGE
$ git merge <branch_name>
Fast Forward Merge
IGNORING FILES: .GITINGNORE
GIT MERGE CONFLICT
 When two people edit the same line having different branch with
different commit history.
 If c3 and c4 commit edit the same line & we want to merge iss53
branch into master branch, then the conflict happens.
GIT FORK AND CLONE
$ git clone REMOTE_URL
NOTE: It sets the remote repository URL while performing git clone command.
PULL REQUEST
• Pull request is created by comparing changes in branches.
• Once a pull request is sent, interested parties can review the set
of changes, discuss potential modifications, and even push
follow-up commits if necessary
ISSUES
• Issues are a great way to keep track of tasks.
• Issues can act as more than just a place to report software bugs.
ADD-ONS MOZILLA GITHUB REPOSITORY
 Open source, where anyone can contribute code
 How can one contribute code:
 Fix any mentioned issue in your forked repository
and send a pull request
https://github.com/mozilla/addons-server
HOW WILL YOU COLLABORATIVELY
WORK ON YOUR PROJECT
 Break each features into small piece of work and write them as
issues in GitHub.
 Everytime you work on an issue, you open a new branch and
make a patch on that branch for the issue.
 When you make the patch, send a pull request to master branch
from that branch (that branch where you have made the patch
that fixes the issue)
REFERENCES
• ProGit book – https://git-scm.com/book/en/v2
• Interactive git learning online -
https://learngitbranching.js.org/

Weitere ähnliche Inhalte

Was ist angesagt?

Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowMikhail Melnik
 
Learning git
Learning gitLearning git
Learning gitSid Anand
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
Git pour les (pas si) nuls
Git pour les (pas si) nulsGit pour les (pas si) nuls
Git pour les (pas si) nulsMalk Zameth
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentationAyanaRukasar
 
Git, Github, Versiyon Kontrolü 101
Git, Github, Versiyon Kontrolü 101Git, Github, Versiyon Kontrolü 101
Git, Github, Versiyon Kontrolü 101OnurSercanYlmaz
 
Git workflows
Git workflowsGit workflows
Git workflowsXpand IT
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Noa Harel
 

Was ist angesagt? (20)

Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
Learning git
Learning gitLearning git
Learning git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git pour les (pas si) nuls
Git pour les (pas si) nulsGit pour les (pas si) nuls
Git pour les (pas si) nuls
 
Git101
Git101Git101
Git101
 
Github
GithubGithub
Github
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentation
 
Github
GithubGithub
Github
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git, Github, Versiyon Kontrolü 101
Git, Github, Versiyon Kontrolü 101Git, Github, Versiyon Kontrolü 101
Git, Github, Versiyon Kontrolü 101
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 

Ähnlich wie Introduction to Git and Github

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 Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?9 series
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxAbelPhilipJoseph
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03Gourav Varma
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
Git slides
Git slidesGit slides
Git slidesNanyak S
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
 

Ähnlich wie Introduction to Git and Github (20)

Git and Github
Git and GithubGit and Github
Git and Github
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Git and github
Git and githubGit and github
Git and github
 
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 Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git overview
Git overviewGit overview
Git overview
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Git
GitGit
Git
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git github
Git githubGit github
Git github
 
Git introduction
Git introductionGit introduction
Git introduction
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git slides
Git slidesGit slides
Git slides
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 

Kürzlich hochgeladen

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Kürzlich hochgeladen (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Introduction to Git and Github

  • 1. INTRODUCTION TO GIT AND GITHUB ATIQUE AHMED ZIAD LEAD DEVELOPER, LEGALX LTD. MOZILLA REPRESENTATIVE
  • 2. LET’S DISCUSS SOME ISSUES…  Can not work parallelly.  No version controlling.  Wrestling with bugs.  Revision is not made easy.
  • 3. WHAT IS GIT AND GITHUB “Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.” “GitHub is a cloud based platform built around the Git tool. It is an online service that stores code pushed to it from computers running the Git tool. It offers all of the distributed version control and source code management functionality of Git as well as adding its own features.”
  • 4. A SHORT STORY OF GIT In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper In 2005, BitKeeper’s free-of-charge status was revoked. This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool. This gave birth to Git in 2005. It’s amazingly fast, very efficient with large projects, and it has an incredible branching system for non-linear development
  • 5. INSTALLATION OF GIT  Download Git from https://git-scm.com/downloads  Downloaded ? Time to install it !  Verify Git installation. Git Config Username config: Email config: $ git config --global user.name yourusername $ git config --global user.email youremail@example.com $ git
  • 6. MAKE YOUR FIRST REPOSITORY IN GITHUB  Open a new repository in Github.  Choose / create a directory with some files inside it. Follow the below commands in Terminal / CMD: This will initialize Git in the directory. A folder named .git has been created. The git status command displays the state of the working directory and the staging area. $ git init $ git status
  • 7. MAKE YOUR FIRST REPOSITORY IN GITHUB $ git add . $ git commit –m “commit title” $ git remote add origin <REMOTE_URL> $ git push –u origin master Git add all files Commit the added files Set remote repository url (if not set previously) Push to remote repository Checkout remote urls $ git remote -v
  • 8. CONGRATULATION ! YOU HAVE UPLOADED YOUR FIRST GIT REPOSITORY.
  • 10. RECORDING CHANGES TO THE REPOSITORY
  • 11. GIT COMMIT • A commit in a git repository records a snapshot of all the files in your directory. It's like a giant copy and paste, but even better! • A commit takes all staged changes into it. $ git commit –m “commit title”
  • 12. VIEWING COMMIT HISTORY $ git log VIEW LOG WITH PATCH AND LAST ENTRIES $ git log –p -1 -p stands for patch which shows the differences in each commit -1 used for showing only last one commit
  • 13. POINTER & HEAD When you make a commit, Git stores a commit object that contains a pointer to the snapshot of the content you staged. How does Git know what branch you’re currently on? It keeps a special pointer called HEAD.
  • 14. GIT BRANCHES Branching means you diverge from the main line of development and continue to do work without messing with that main line. • Branches in git are incredibly lightweight. • They are simply pointers to a specific commit -- nothing more. • “Killer Feature” of git.
  • 15. GIT CREATING NEW BRANCH $ git branch <branch_name> Here the new branch name is testing
  • 16. GIT BRANCHES COMMANDS $ git checkout –b <branch_name> Opening a new branch and switching to that branch $ git checkout –d <branch_name> Deleting a local branch $ git push <remote_name> –d <branch_name> Deleting a remote branch $ git checkout <branch_name> Switching to a branch $ git branch See all branches
  • 17. GIT MERGE $ git merge <branch_name> Fast Forward Merge
  • 19. GIT MERGE CONFLICT  When two people edit the same line having different branch with different commit history.  If c3 and c4 commit edit the same line & we want to merge iss53 branch into master branch, then the conflict happens.
  • 20. GIT FORK AND CLONE $ git clone REMOTE_URL NOTE: It sets the remote repository URL while performing git clone command.
  • 21. PULL REQUEST • Pull request is created by comparing changes in branches. • Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary ISSUES • Issues are a great way to keep track of tasks. • Issues can act as more than just a place to report software bugs.
  • 22. ADD-ONS MOZILLA GITHUB REPOSITORY  Open source, where anyone can contribute code  How can one contribute code:  Fix any mentioned issue in your forked repository and send a pull request https://github.com/mozilla/addons-server
  • 23. HOW WILL YOU COLLABORATIVELY WORK ON YOUR PROJECT  Break each features into small piece of work and write them as issues in GitHub.  Everytime you work on an issue, you open a new branch and make a patch on that branch for the issue.  When you make the patch, send a pull request to master branch from that branch (that branch where you have made the patch that fixes the issue)
  • 24. REFERENCES • ProGit book – https://git-scm.com/book/en/v2 • Interactive git learning online - https://learngitbranching.js.org/