SlideShare une entreprise Scribd logo
1  sur  42
Code is like poetry, and Git
helps us write it together,
beautifully and
collaboratively, one commit
at a time.
Srinjay Das Gupta
Google DSC’23 Web Dev Lead
Narula Institute of Technology
Intermediate Git
Concepts and Tools
Narula Institute of Technology
• Brief Introduction to Git
• Git Branches
• Merging
• Rebasing
• Merging Conflicts
• Remotes
• Forks
• Pull Requests
• Git Situational Tools
• All about Open Source
Agenda
Brief Introduction to Git
Narula Institute of Technology
What is Git?
What is Git?
Git is free and open source software for distributed version
control: tracking changes in any set of files, usually used for
coordinating work among programmers collaboratively
developing source code during software development.
Basic Git Commands
1. git init:
This command initialises a new git repository
2. git clone:
This command creates a copy of a remote
repository in your local machine
3. git push:
This command updates staged local changes to the
remote
4. git pull:
This command updates local machine with changes
made in the remote
Git Branches and how
to use them
Narula Institute of Technology
What are Branches?
How to Create, Rename
and Delete Branches
● Create: git branch
<branch name>
● Rename: git branch -m
<new branch name>
● Delete: git branch -d
<branch name>
Narula Institute Of Technology
What do we do after we
finished working on a
branch?
WE…
How do we Merge?
We merge by:
1. Checkout the target
branch
2. Run the command:
git merge <branch name>
Git Rebase
Narula Institute of Technology
Narula Institute of technology
How do we Rebase
● First we checkout the branch we want to
rebase
● Then we run the command:
git rebase <target branch name>
Merging vs Rebasing:
Merging Pros
● Preserves History 📑
● Better for Merge
Conflicts✅
● Easy to undo 🔄
Rebasing Pros
● Cleaner History 📃
● More readable graph 👀
● Tougher to resolve
conflicts ⚠️
Merge Conflicts
Narula Institute of Technology
Merge Conflicts Can Occur During
Merging a Branch Rebasing Cherry Picking
Remotes, Forks and
Pull Requests
Narula Institute of Technology
Remotes
● Git remotes are remote
repositories (like
GitHub) where you store
and synchronize copies of
your project.
Fork
● A clone of a git
repository, typically
hosted on a git hosting
service
Pull Request
● An event where a
contributor asks a repo
manager to review code
they wish to merge into a
project
● Also known as Merge
Request
Git Situational Tools
Situational Tools:
● Stashing
● Cherry Picking
● Squashing
What is Stashing?
Narula Institute of Technology
How to Stash and apply stashed changes?
Stashing Changes:
To stash unstaged changes, you
simply run the command: git
stash and it will store all the
changes in the stash stack.
There are two ways of applying
stashed changes:
● git stash apply: This
applies the most recent
stashed change to the
working directory but it
also keeps it stored in the
stash stack
● git stash pop: It does the
same work, but deletes it
from the stash stack
What is Cherry Picking?
Narula Institute of Technology
Git cherry-pick lets you
selectively apply
individual commits from
one branch to another.
Cherry Picking Illustration
Narula Institute of Technology
How to Cherry Pick
To cherry pick a commit we need the SHA of the commit(s).
This can be done by running a git log on the branch from
where to cherry pick.
Finally to cherry pick:
● Checkout the target branch
● Run: git cherry-pick <commitSHA>
● To cherry pick multiple commits, add the SHA ids of the
commits one by one and git will cherry pick them in the
order they are given in the command. Like:
git cherry-pick <commit1SHA> <commit2SHA> ...
Of course, your alternative is to copy-paste all your changes to
the new branch.
CAUTION ⚠️
Cherry Picking should be used
sparingly because:
● it can lead to merge
conflicts
● it can cause duplicate
commits on separate
branches
SQUASHING
Narula Institute of Technology
How to Squash
There are two ways to squash
commits:
● Interactive Rebase
git rebase -i <target
branch name>
● And “--squash” to “git
merge”, i.e.,
git merge --squash
WorkEx doesn’t require a
job letter. You just need a
laptop and a will to work.
Narula Institute of Technology
Rajdip Bhattacharya
Google DSC’23 Cloud & DevOps Lead
Open Source: The nice Parts
Narula Institute of Technology
Why Open-source? And why
should you do it?
● Open source encourages innovation through collaboration.
● It allows customers to know how the code works, facilitating the development
of the most innovative software.
● It allows reuse and recycling of code, making it easier to collaborate and
achieve goals, rather than to recreate the wheel.
● Open source communities
● Growth and networking
● Skill development
● Scope of full time offers
● Bounty
Narula Institute of Technology
Perks of Open Source
Community Questions
● How to find relevant projects
for our contributions?
● When learning a framework, how
can I gauge my readiness to
contribute to an open-source
project despite feeling
overwhelmed by real codebases?
THANKYOU

Contenu connexe

Similaire à Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)

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
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
François D'Agostini
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
upadhyay_25
 

Similaire à Open Sprintera (Where Open Source Sparks a Sprint of Possibilities) (20)

Git github
Git githubGit github
Git github
 
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
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for Beginners
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
 
Git and GitHub Info Session
Git and GitHub Info SessionGit and GitHub Info Session
Git and GitHub Info Session
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
 
Data science Git management
Data science Git managementData science Git management
Data science Git management
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git for work groups ironhack talk
Git for work groups ironhack talkGit for work groups ironhack talk
Git for work groups ironhack talk
 
GDSC ZHCET GitHub Session.pdf
GDSC ZHCET GitHub Session.pdfGDSC ZHCET GitHub Session.pdf
GDSC ZHCET GitHub Session.pdf
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
devops-complete-notes-2.pdf
devops-complete-notes-2.pdfdevops-complete-notes-2.pdf
devops-complete-notes-2.pdf
 

Dernier

Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Lisi Hocke
 

Dernier (20)

UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with GraphGraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmux
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptxFrom Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit MilanWorkshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
 
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
 

Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)

  • 1.
  • 2. Code is like poetry, and Git helps us write it together, beautifully and collaboratively, one commit at a time. Srinjay Das Gupta Google DSC’23 Web Dev Lead Narula Institute of Technology
  • 3. Intermediate Git Concepts and Tools Narula Institute of Technology
  • 4. • Brief Introduction to Git • Git Branches • Merging • Rebasing • Merging Conflicts • Remotes • Forks • Pull Requests • Git Situational Tools • All about Open Source Agenda
  • 5. Brief Introduction to Git Narula Institute of Technology
  • 7. What is Git? Git is free and open source software for distributed version control: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development.
  • 8. Basic Git Commands 1. git init: This command initialises a new git repository 2. git clone: This command creates a copy of a remote repository in your local machine 3. git push: This command updates staged local changes to the remote 4. git pull: This command updates local machine with changes made in the remote
  • 9. Git Branches and how to use them Narula Institute of Technology
  • 11.
  • 12. How to Create, Rename and Delete Branches ● Create: git branch <branch name> ● Rename: git branch -m <new branch name> ● Delete: git branch -d <branch name>
  • 13. Narula Institute Of Technology What do we do after we finished working on a branch? WE…
  • 14. How do we Merge? We merge by: 1. Checkout the target branch 2. Run the command: git merge <branch name>
  • 16. Narula Institute of technology How do we Rebase ● First we checkout the branch we want to rebase ● Then we run the command: git rebase <target branch name>
  • 17.
  • 18. Merging vs Rebasing: Merging Pros ● Preserves History 📑 ● Better for Merge Conflicts✅ ● Easy to undo 🔄 Rebasing Pros ● Cleaner History 📃 ● More readable graph 👀 ● Tougher to resolve conflicts ⚠️
  • 20. Merge Conflicts Can Occur During Merging a Branch Rebasing Cherry Picking
  • 21. Remotes, Forks and Pull Requests Narula Institute of Technology
  • 22. Remotes ● Git remotes are remote repositories (like GitHub) where you store and synchronize copies of your project.
  • 23. Fork ● A clone of a git repository, typically hosted on a git hosting service
  • 24. Pull Request ● An event where a contributor asks a repo manager to review code they wish to merge into a project ● Also known as Merge Request
  • 26. Situational Tools: ● Stashing ● Cherry Picking ● Squashing
  • 27. What is Stashing? Narula Institute of Technology
  • 28. How to Stash and apply stashed changes? Stashing Changes: To stash unstaged changes, you simply run the command: git stash and it will store all the changes in the stash stack. There are two ways of applying stashed changes: ● git stash apply: This applies the most recent stashed change to the working directory but it also keeps it stored in the stash stack ● git stash pop: It does the same work, but deletes it from the stash stack
  • 29. What is Cherry Picking? Narula Institute of Technology
  • 30. Git cherry-pick lets you selectively apply individual commits from one branch to another. Cherry Picking Illustration Narula Institute of Technology
  • 31. How to Cherry Pick To cherry pick a commit we need the SHA of the commit(s). This can be done by running a git log on the branch from where to cherry pick. Finally to cherry pick: ● Checkout the target branch ● Run: git cherry-pick <commitSHA> ● To cherry pick multiple commits, add the SHA ids of the commits one by one and git will cherry pick them in the order they are given in the command. Like: git cherry-pick <commit1SHA> <commit2SHA> ...
  • 32. Of course, your alternative is to copy-paste all your changes to the new branch.
  • 33. CAUTION ⚠️ Cherry Picking should be used sparingly because: ● it can lead to merge conflicts ● it can cause duplicate commits on separate branches
  • 35. How to Squash There are two ways to squash commits: ● Interactive Rebase git rebase -i <target branch name> ● And “--squash” to “git merge”, i.e., git merge --squash
  • 36. WorkEx doesn’t require a job letter. You just need a laptop and a will to work. Narula Institute of Technology Rajdip Bhattacharya Google DSC’23 Cloud & DevOps Lead
  • 37. Open Source: The nice Parts Narula Institute of Technology
  • 38. Why Open-source? And why should you do it? ● Open source encourages innovation through collaboration. ● It allows customers to know how the code works, facilitating the development of the most innovative software. ● It allows reuse and recycling of code, making it easier to collaborate and achieve goals, rather than to recreate the wheel.
  • 39.
  • 40. ● Open source communities ● Growth and networking ● Skill development ● Scope of full time offers ● Bounty Narula Institute of Technology Perks of Open Source
  • 41. Community Questions ● How to find relevant projects for our contributions? ● When learning a framework, how can I gauge my readiness to contribute to an open-source project despite feeling overwhelmed by real codebases?

Notes de l'éditeur

  1. As web developers, mastering Git is essential. Today, we'll explore this invaluable tool, breaking down its magic and transforming you from a solo coder to a collaborative rockstar! Forget confusion, embrace clarity, and let's write code that shines even when we're working in different time zones.