SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
$ git init
Intro to Git and GitHub
Big thanks to Krish Chowdhary (GDSC Alumni) for allowing us to re-use some of his old slides!
If you haven’t already installed it… (~8 min)
Creating GitHub Account: github.com/join
Download Git for...
Windows: git-scm.com/download/win
Linux:
● sudo apt install git-all (if you use a Debian-based Linux)
● OR sudo dnf install git-all (if you use a Red Hat-based Linux)
MacOS:
● git-scm.com/download/mac
● OR type brew install git in your terminal (if you have homebrew)
Some icebreaker questions in the meantime
1. What year are you in?
2. What POSt are you in or planning on pursuing?
3. Have you ever used Git before?
4. What is your favourite programming language?
5. Any questions for us? 😄
What is Git?
Collaboration
Version control
More
● Git is a version control system
● A software that you interact with through your
terminal/command line
● Allows you to keep track of changes made to
your project
● Facilitates effective collaboration for multiple
individuals working on one project
Ever done something like this?
A better way? use Git
GitHub
● A website that is the central location on the internet
where you push (upload) and pull (download) code from
● From there people can view the project and its version
history and starting contributing to it
● Think of it as a super advanced Google Drive
● Let’s take a look at an example GitHub repository:
github.com/utmmcss/mcss-website-frontend
● Repository: the collection of all the versions of the files in a
project
●
What is GitHub?
Git != GitHub
Git is a command line tool. GitHub is a website
GitHub Diagram
Milind’s PC
Daniel’s PC Nivy’s PC
GitHub
Let’s git started.
Hands-on activity: forking and clon(e)ing (~5min)
Your task:
1. Visit github.com/Daniel-Laufer/GDSCUTM-git-workshop
2. Click the “Fork” button
○ This will create a copy of this repository where your GitHub account is the owner
3. Then in your terminal (on your local computer) type: git clone <your forked repository url>.git
○ This will essentially download your repository from GitHub to your computer
4. Type: ls (first letter is a lowercase ‘L’). This command lists out everything in your current directory
○ You will see a new directory listed (aka a folder)
5. Type: cd <the name of this new directory> to “move” into that directory
Don’t forget the .git suffix
Remove the “<>” before using
Version control basics with Git
1. Staging & Committing
1. Staging & Committing
edit
1. Staging & Committing
edit save
1. Staging & Committing “Main” git branch
Initial
commit
1. Staging & Committing
edit
“Main” git branch
Initial
commit
1. Staging & Committing
edit save
Initial
commit
“main” git branch
1. Staging & Committing
edit save
add
“main” git branch
Initial
commit
1. Staging & Committing
edit save
commit
add
“main” git branch
Initial
commit
New
commit
Hold up… what’s a commit again?
It’s simply a change to your project that git records in its
version history.
Staging & Committing
1st
commit
2nd
commit
Staging & Committing
1st
commit
2nd
commit
3rd
commit
Staging & Committing
3rd
commit
4th
commit
2nd
commit
1st
commit
1. Staging & Committing
Initial
Save
New
Save
New
Save
New
Save
New
Save
Staging & Committing
1st
commit
2nd
commit
3rd
commit
4th
commit
5th
commit
Hands-on activity: adding & committing (~5 min)
Instructions (ensure you are in the directory we downloaded last time)
1. Type git status
○ Git should tell you that everything is up to date
2. On your computer, make a change to any of the files and save that file
3. Now again type git status
○ You should see that git saw the change you just made
4. Type git add <your filename>
○ This will “stage” or in other words “prepare” your file for commiting
5. Type git commit -m “<whatever message you want goes here :)>”
○ This will tell git to “save” your file modifications in its version history
6. Type git log to see a list of your recent commits
7. (Optional) type git push to “push”, or in other words upload, your changes to your github
Hands On!
10 minutes
$ cd into the repository
$ Open index.html and
make some changes
$ git status
$ git add index.html
$ git commit -m “msg”
$ git log
Git Branching and Merging
Git branches
● Think of Git’s version history as a tree (the weird CS type of tree)
● Git branches are basically “independent lines/sections of
development”
c2
c1
c5
c3 c4
Branch #1
Branch #2
Why use Branches?
Example: a different branch used for different versions
of a codebase
c2
c1
c5
c3 c4
“main” branch
“dev” branch
Another example
Using a separate branch to develop a new feature.
c2
c1
c5
c3 c4
“main” branch
“create_cat_pic_api” branch
How are branches used? Continued
Example: a different branch used for different versions
of a codebase
c2
c1
c5
c3 c4
“Production” branch
“Development” branch
Branches
Initial
Commit
2nd
Commit
3rd
Commit
4th
Commit
5th
Commit
2. Branches
main
new branch
2. Branches
main
new branch
2. Branches
main
new branch
2. Branches
main
new branch
Merging
● To “merge” your current branch with
another you use the command git
merge <other branch name>
● Git will intelligently combine all changes
from that one branch with another
● foreshadowing: Git might have some
trouble doing this sometimes :(
Merging
main
new branch
Merging
main
new branch
Hands-on activity: Branching and Merging
Instructions (ensure you are in the directory we used last time)
1. Type git branch
○ This will tell you what branch you are currently using
2. Type git branch <some name> to create a new branch
3. Type git switch <some name> to switch to this new name (redo step 1 to confirm this!)
○ Note: git checkout <some name> does the same thing but is the old way of doing it
4. Make some change to any file and git add <file name> and git commit <file name> that file
○ Note that these changes are only being committed to branch <some name>
5. Type git switch main
6. Type git merge <some name> (remember that main is the name of the other branch)
Hands On!
10 minutes
$ git branch demo
$ git checkout demo
$ change lines 10-24, add,
commit, log
$ git checkout master
$ make different changes on
lines 10-24, add, and
commit, log - notice how
our last commit isn’t there?
$ git merge demo
$ uh-oh
Merge conflict when Merging goes wrong
main
new branch
Lines
10-24
Lines
10-24
Merge Conflict Demo
main
branch2
...
Some arbitrary
number of prior
commits
git branch -c
branch2
Make an edit to
main.py, save,
add, commit
main
branch2
...
Some arbitrary
number of prior
commits
Modify LINE 9 of
file_actions.py,
save, add, commit
git branch -c
branch2
Make an edit to
main.py, save,
add, commit
main
branch2
...
Some arbitrary
number of prior
commits
git branch -c
branch2
Make an edit to
main.py, save,
add, commit
Modify LINE 9 of
file_actions.py,
save, add, commit
Modify LINE 9 of
file_actions.py,
save, add, commit
main
branch2
...
Some arbitrary
number of prior
commits
git branch -c
branch2
“updated
main.py”
git merge branch3
Modify LINE 9 of
file_actions.py,
save, add, commit
Modify LINE 9 of
file_actions.py,
save, add, commit
main
branch2
...
Some arbitrary
number of prior
commits
git branch -c
branch2
“updated
main.py”
git merge branch3
Modify LINE 9 of
file_actions.py,
save, add, commit
Modify LINE 9 of
file_actions.py,
save, add, commit
Successfully merged after
resolving all conflicts
main
branch2
...
Some arbitrary
number of prior
commits
“modified LINE 9
of file_actions.py”
git branch -c
branch2
“updated
main.py”
“modified LINE 9
of file_actions.py”
“resolved all conflicts
and merged”
Merge Conflict
5 minutes
$ open up the index.html file
and scroll to line 10
$ You should see some text
generated by git
$ Fix the conflict.
$ git add index.html
$ git commit -m “merged”
How does this all work with GitHub?
GitHub Repository Local Repository
GitHub Repository Local Repository
git pull
GitHub Repository Local Repository
git push
GitHub Repository Local Repository
git merge <branch name>
GitHub Repository
Local Repository
git push
What we talked
about today
1. Cloning/Forking
2. Staging & Committing
3. Branches
4. Merging
5. Pushing & Pulling
Other useful Git commands, concepts, and tools
● Rebasing:
https://www.youtube.com/watch?v=7Mh259hfxJg
● Making pull requests:
https://www.youtube.com/watch?v=8lGpZkjnkt4
● Git kraken: a GUI for Git
○ https://www.gitkraken.com/
Thank you all so much for coming!
Before you go...
● Would you like to join the GDSC team? We are hiring! Please apply here (deadline
Friday Sept 24th at midnight)
○ https://docs.google.com/forms/d/e/1FAIpQLSfsTcH9VLxIDb4r3Alv0wWT2s60lK
W-fAifeafe5E77BKJCQg/viewform
● What workshops would you like to see in the future? Please let us know here!
○ https://docs.google.com/forms/d/e/1FAIpQLScYpTz67WMiHqXYgH5uPobtSxry
oww7yCchmF9goagGFZxEzg/viewform
The “Intro to web development, HTML/CSS, and Javascript workshop!”
● October 2nd at 4 pm
● Milind will be leading that workshop!
We hope to see you next time at….

Contenu connexe

Tendances

Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
 
Git workflows
Git workflowsGit workflows
Git workflowsXpand IT
 
Git Terminologies
Git TerminologiesGit Terminologies
Git TerminologiesYash
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
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 flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily useMediacurrent
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentationMack Hardy
 
Learning git
Learning gitLearning git
Learning gitSid Anand
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 

Tendances (20)

Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git commands
Git commandsGit commands
Git commands
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
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 ...
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Github
GithubGithub
Github
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Learning git
Learning gitLearning git
Learning git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git github
Git githubGit github
Git github
 

Similaire à Git Init (Introduction to Git)

Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - WorkflowTahsin Abrar
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | WorkshopAnuchit Chalothorn
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 WorkshopJoy Seng
 
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
 
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 tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git聖文 鄭
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git for developers
Git for developersGit for developers
Git for developersHacen Dadda
 

Similaire à Git Init (Introduction to Git) (20)

git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
16 Git
16 Git16 Git
16 Git
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Git
GitGit
Git
 
Git Primer
Git PrimerGit Primer
Git Primer
 
14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Formation git
Formation gitFormation git
Formation git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git for developers
Git for developersGit for developers
Git for developers
 

Plus de GDSC UofT Mississauga

Plus de GDSC UofT Mississauga (20)

CSSC ML Workshop
CSSC ML WorkshopCSSC ML Workshop
CSSC ML Workshop
 
ICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and FigmaICCIT Council × GDSC: UX / UI and Figma
ICCIT Council × GDSC: UX / UI and Figma
 
Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023
 
GDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami WorkshopGDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami Workshop
 
Reverse Engineering 101
Reverse Engineering 101Reverse Engineering 101
Reverse Engineering 101
 
Michael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop WorkshopMichael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop Workshop
 
MCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity WorkshopMCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity Workshop
 
Basics of C
Basics of CBasics of C
Basics of C
 
Discord Bot Workshop Slides
Discord Bot Workshop SlidesDiscord Bot Workshop Slides
Discord Bot Workshop Slides
 
Web Scraping Workshop
Web Scraping WorkshopWeb Scraping Workshop
Web Scraping Workshop
 
Devops Workshop
Devops WorkshopDevops Workshop
Devops Workshop
 
Express
ExpressExpress
Express
 
HTML_CSS_JS Workshop
HTML_CSS_JS WorkshopHTML_CSS_JS Workshop
HTML_CSS_JS Workshop
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
 
Back-end (Flask_AWS)
Back-end (Flask_AWS)Back-end (Flask_AWS)
Back-end (Flask_AWS)
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Database Workshop Slides
Database Workshop SlidesDatabase Workshop Slides
Database Workshop Slides
 
ChatGPT General Meeting
ChatGPT General MeetingChatGPT General Meeting
ChatGPT General Meeting
 
Elon & Twitter General Meeting
Elon & Twitter General MeetingElon & Twitter General Meeting
Elon & Twitter General Meeting
 

Dernier

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
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
 
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
 
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
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Dernier (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
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
 
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
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.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
 
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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Git Init (Introduction to Git)

  • 1. $ git init Intro to Git and GitHub Big thanks to Krish Chowdhary (GDSC Alumni) for allowing us to re-use some of his old slides!
  • 2. If you haven’t already installed it… (~8 min) Creating GitHub Account: github.com/join Download Git for... Windows: git-scm.com/download/win Linux: ● sudo apt install git-all (if you use a Debian-based Linux) ● OR sudo dnf install git-all (if you use a Red Hat-based Linux) MacOS: ● git-scm.com/download/mac ● OR type brew install git in your terminal (if you have homebrew)
  • 3. Some icebreaker questions in the meantime 1. What year are you in? 2. What POSt are you in or planning on pursuing? 3. Have you ever used Git before? 4. What is your favourite programming language? 5. Any questions for us? 😄
  • 6. ● Git is a version control system ● A software that you interact with through your terminal/command line ● Allows you to keep track of changes made to your project ● Facilitates effective collaboration for multiple individuals working on one project
  • 7. Ever done something like this? A better way? use Git
  • 9. ● A website that is the central location on the internet where you push (upload) and pull (download) code from ● From there people can view the project and its version history and starting contributing to it ● Think of it as a super advanced Google Drive ● Let’s take a look at an example GitHub repository: github.com/utmmcss/mcss-website-frontend ● Repository: the collection of all the versions of the files in a project ● What is GitHub?
  • 10. Git != GitHub Git is a command line tool. GitHub is a website
  • 13. Hands-on activity: forking and clon(e)ing (~5min) Your task: 1. Visit github.com/Daniel-Laufer/GDSCUTM-git-workshop 2. Click the “Fork” button ○ This will create a copy of this repository where your GitHub account is the owner 3. Then in your terminal (on your local computer) type: git clone <your forked repository url>.git ○ This will essentially download your repository from GitHub to your computer 4. Type: ls (first letter is a lowercase ‘L’). This command lists out everything in your current directory ○ You will see a new directory listed (aka a folder) 5. Type: cd <the name of this new directory> to “move” into that directory Don’t forget the .git suffix Remove the “<>” before using
  • 15. 1. Staging & Committing
  • 16. 1. Staging & Committing edit
  • 17. 1. Staging & Committing edit save
  • 18. 1. Staging & Committing “Main” git branch Initial commit
  • 19. 1. Staging & Committing edit “Main” git branch Initial commit
  • 20. 1. Staging & Committing edit save Initial commit “main” git branch
  • 21. 1. Staging & Committing edit save add “main” git branch Initial commit
  • 22. 1. Staging & Committing edit save commit add “main” git branch Initial commit New commit
  • 23. Hold up… what’s a commit again? It’s simply a change to your project that git records in its version history.
  • 27. 1. Staging & Committing Initial Save New Save New Save New Save New Save
  • 29. Hands-on activity: adding & committing (~5 min) Instructions (ensure you are in the directory we downloaded last time) 1. Type git status ○ Git should tell you that everything is up to date 2. On your computer, make a change to any of the files and save that file 3. Now again type git status ○ You should see that git saw the change you just made 4. Type git add <your filename> ○ This will “stage” or in other words “prepare” your file for commiting 5. Type git commit -m “<whatever message you want goes here :)>” ○ This will tell git to “save” your file modifications in its version history 6. Type git log to see a list of your recent commits 7. (Optional) type git push to “push”, or in other words upload, your changes to your github
  • 30. Hands On! 10 minutes $ cd into the repository $ Open index.html and make some changes $ git status $ git add index.html $ git commit -m “msg” $ git log
  • 31. Git Branching and Merging
  • 32. Git branches ● Think of Git’s version history as a tree (the weird CS type of tree) ● Git branches are basically “independent lines/sections of development” c2 c1 c5 c3 c4 Branch #1 Branch #2
  • 33. Why use Branches? Example: a different branch used for different versions of a codebase c2 c1 c5 c3 c4 “main” branch “dev” branch
  • 34. Another example Using a separate branch to develop a new feature. c2 c1 c5 c3 c4 “main” branch “create_cat_pic_api” branch
  • 35. How are branches used? Continued Example: a different branch used for different versions of a codebase c2 c1 c5 c3 c4 “Production” branch “Development” branch
  • 41. Merging ● To “merge” your current branch with another you use the command git merge <other branch name> ● Git will intelligently combine all changes from that one branch with another ● foreshadowing: Git might have some trouble doing this sometimes :(
  • 44. Hands-on activity: Branching and Merging Instructions (ensure you are in the directory we used last time) 1. Type git branch ○ This will tell you what branch you are currently using 2. Type git branch <some name> to create a new branch 3. Type git switch <some name> to switch to this new name (redo step 1 to confirm this!) ○ Note: git checkout <some name> does the same thing but is the old way of doing it 4. Make some change to any file and git add <file name> and git commit <file name> that file ○ Note that these changes are only being committed to branch <some name> 5. Type git switch main 6. Type git merge <some name> (remember that main is the name of the other branch)
  • 45. Hands On! 10 minutes $ git branch demo $ git checkout demo $ change lines 10-24, add, commit, log $ git checkout master $ make different changes on lines 10-24, add, and commit, log - notice how our last commit isn’t there? $ git merge demo $ uh-oh
  • 46. Merge conflict when Merging goes wrong main new branch Lines 10-24 Lines 10-24
  • 48. main branch2 ... Some arbitrary number of prior commits git branch -c branch2 Make an edit to main.py, save, add, commit
  • 49. main branch2 ... Some arbitrary number of prior commits Modify LINE 9 of file_actions.py, save, add, commit git branch -c branch2 Make an edit to main.py, save, add, commit
  • 50. main branch2 ... Some arbitrary number of prior commits git branch -c branch2 Make an edit to main.py, save, add, commit Modify LINE 9 of file_actions.py, save, add, commit Modify LINE 9 of file_actions.py, save, add, commit
  • 51. main branch2 ... Some arbitrary number of prior commits git branch -c branch2 “updated main.py” git merge branch3 Modify LINE 9 of file_actions.py, save, add, commit Modify LINE 9 of file_actions.py, save, add, commit
  • 52. main branch2 ... Some arbitrary number of prior commits git branch -c branch2 “updated main.py” git merge branch3 Modify LINE 9 of file_actions.py, save, add, commit Modify LINE 9 of file_actions.py, save, add, commit Successfully merged after resolving all conflicts
  • 53. main branch2 ... Some arbitrary number of prior commits “modified LINE 9 of file_actions.py” git branch -c branch2 “updated main.py” “modified LINE 9 of file_actions.py” “resolved all conflicts and merged”
  • 54. Merge Conflict 5 minutes $ open up the index.html file and scroll to line 10 $ You should see some text generated by git $ Fix the conflict. $ git add index.html $ git commit -m “merged”
  • 55. How does this all work with GitHub?
  • 57. GitHub Repository Local Repository git pull
  • 58. GitHub Repository Local Repository git push
  • 59. GitHub Repository Local Repository git merge <branch name>
  • 61. What we talked about today 1. Cloning/Forking 2. Staging & Committing 3. Branches 4. Merging 5. Pushing & Pulling
  • 62. Other useful Git commands, concepts, and tools ● Rebasing: https://www.youtube.com/watch?v=7Mh259hfxJg ● Making pull requests: https://www.youtube.com/watch?v=8lGpZkjnkt4 ● Git kraken: a GUI for Git ○ https://www.gitkraken.com/
  • 63. Thank you all so much for coming!
  • 64. Before you go... ● Would you like to join the GDSC team? We are hiring! Please apply here (deadline Friday Sept 24th at midnight) ○ https://docs.google.com/forms/d/e/1FAIpQLSfsTcH9VLxIDb4r3Alv0wWT2s60lK W-fAifeafe5E77BKJCQg/viewform ● What workshops would you like to see in the future? Please let us know here! ○ https://docs.google.com/forms/d/e/1FAIpQLScYpTz67WMiHqXYgH5uPobtSxry oww7yCchmF9goagGFZxEzg/viewform
  • 65. The “Intro to web development, HTML/CSS, and Javascript workshop!” ● October 2nd at 4 pm ● Milind will be leading that workshop! We hope to see you next time at….