SlideShare a Scribd company logo
$ 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….

More Related Content

What's hot

Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
Noa Harel
 
Mono Repo
Mono RepoMono Repo
Mono Repo
Zacky Pickholz
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
Noa Harel
 
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
Anwarul Islam
 
Get started with gitops and flux
Get started with gitops and fluxGet started with gitops and flux
Get started with gitops and flux
LibbySchulze1
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
Omar Fathy
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Panagiotis Papadopoulos
 
GitHub Actions in action
GitHub Actions in actionGitHub Actions in action
GitHub Actions in action
Oleksii Holub
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With GitflowJosh Dvir
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Houari ZEGAI
 
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDKubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Sunnyvale
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHub
Nishan Bose
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 

What's hot (20)

Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Introducing GitLab (June 2018)
Introducing GitLab (June 2018)Introducing GitLab (June 2018)
Introducing GitLab (June 2018)
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
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
 
Get started with gitops and flux
Get started with gitops and fluxGet started with gitops and flux
Get started with gitops and flux
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
GitHub Actions in action
GitHub Actions in actionGitHub Actions in action
GitHub Actions in action
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With Gitflow
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCDKubernetes GitOps featuring GitHub, Kustomize and ArgoCD
Kubernetes GitOps featuring GitHub, Kustomize and ArgoCD
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 

Similar to Git Init (Introduction to Git)

git2.ppt
git2.pptgit2.ppt
git2.ppt
ssusered2ec2
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
Tahsin Abrar
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
Priyanka Nag
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Git 101 Workshop
Git 101 WorkshopGit 101 Workshop
Git 101 Workshop
Joy 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
 
Git
GitGit
Git Primer
Git PrimerGit Primer
Git Primer
Michael Pearce
 
14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx
GDSCGHRIETNagpur
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
Nyros Technologies
 
Git tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
聖文 鄭
 
git2.ppt
git2.pptgit2.ppt
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Formation git
Formation gitFormation git
Formation git
Ghariani Tewfik
 

Similar to 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
 
Git github
Git githubGit github
Git github
 
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
 

More from GDSC UofT Mississauga

CSSC ML Workshop
CSSC ML WorkshopCSSC ML Workshop
CSSC ML Workshop
GDSC UofT Mississauga
 
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
GDSC UofT Mississauga
 
Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023Community Projects Info Session Fall 2023
Community Projects Info Session Fall 2023
GDSC UofT Mississauga
 
GDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami WorkshopGDSC x Deerhacks - Origami Workshop
GDSC x Deerhacks - Origami Workshop
GDSC UofT Mississauga
 
Reverse Engineering 101
Reverse Engineering 101Reverse Engineering 101
Reverse Engineering 101
GDSC UofT Mississauga
 
Michael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop WorkshopMichael's OWASP Juice Shop Workshop
Michael's OWASP Juice Shop Workshop
GDSC UofT Mississauga
 
MCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity WorkshopMCSS × GDSC: Intro to Cybersecurity Workshop
MCSS × GDSC: Intro to Cybersecurity Workshop
GDSC UofT Mississauga
 
Basics of C
Basics of CBasics of C
Discord Bot Workshop Slides
Discord Bot Workshop SlidesDiscord Bot Workshop Slides
Discord Bot Workshop Slides
GDSC UofT Mississauga
 
Web Scraping Workshop
Web Scraping WorkshopWeb Scraping Workshop
Web Scraping Workshop
GDSC UofT Mississauga
 
Devops Workshop
Devops WorkshopDevops Workshop
Devops Workshop
GDSC UofT Mississauga
 
Express
ExpressExpress
HTML_CSS_JS Workshop
HTML_CSS_JS WorkshopHTML_CSS_JS Workshop
HTML_CSS_JS Workshop
GDSC UofT Mississauga
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
GDSC UofT Mississauga
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
GDSC UofT Mississauga
 
Back-end (Flask_AWS)
Back-end (Flask_AWS)Back-end (Flask_AWS)
Back-end (Flask_AWS)
GDSC UofT Mississauga
 
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]
GDSC UofT Mississauga
 
Database Workshop Slides
Database Workshop SlidesDatabase Workshop Slides
Database Workshop Slides
GDSC UofT Mississauga
 
ChatGPT General Meeting
ChatGPT General MeetingChatGPT General Meeting
ChatGPT General Meeting
GDSC UofT Mississauga
 
Elon & Twitter General Meeting
Elon & Twitter General MeetingElon & Twitter General Meeting
Elon & Twitter General Meeting
GDSC UofT Mississauga
 

More from 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
 

Recently uploaded

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

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….