SlideShare a Scribd company logo
1 of 30
Download to read offline
Git and Github
A developer’s best friend
What is Git?
!2
What is Git?
• Git is a Version Control System (VCS) designed to make it
easier to have multiple versions of a code base,
sometimes across multiple developers or teams
!3
What is Git?
• Git is a Version Control System (VCS) designed to make it
easier to have multiple versions of a code base,
sometimes across multiple developers or teams
• It allows you to see changes you make to your code and
easily revert them.
!4
What is Git?
• Git is a Version Control System (VCS) designed to make it
easier to have multiple versions of a code base,
sometimes across multiple developers or teams
• It allows you to see changes you make to your code and
easily revert them.
• It is NOT GITHUB!
!5
Ok, then what is Github?
• Github.com is a website that hosts git repositories on a
remote server
!6
Ok, then what is Github?
• Github.com is a website that hosts git repositories on a
remote server
• Hosting repositories on Github facilitates the sharing of
codebases among teams by providing a GUI to easily fork
or clone repos to a local machine
!7
Ok, then what is Github?
• Github.com is a website that hosts git repositories on a
remote server
• Hosting repositories on Github facilitates the sharing of
codebases among teams by providing a GUI to easily fork or
clone repos to a local machine
• By pushing your repositories to Github, you will pretty much
automatically create your own developer portfolio as well!
!8
Confirm that you have git
• Open your terminal and run ‘git’
• If you see a ‘command not recognized’ error, you
probably haven’t installed git yet.
• We can solve your issue when the lectures are over - sit
tight for now!
Configuring git
Your commits will have your name and email attached to them. To
confirm that this information is correct, run the following commands:
$ git config --global user.name
> should be your name, i.e. Jon Rosado
$ git config --global user.email
> should be your email, i.e. jon.rosado42@gmail.com
To fix either, just add the desired value in quotes after the command:
$ git config --global user.name “Jon Rosado”
$ git config --global user.email “jon.rodado42@gmail.com"
Using Git / Github
Connecting git with Github
• In order to prevent having to enter your password each
time you push up to Github, you must configure git and
Github to recognize Secured Shell (SSH) keys that you
generate.
• To check and see if you have any recognized SSH keys
active on Github, go to https://github.com/settings/keys
• If you do not see any SSH keys listed, you do not have
SSH configured with Github. We can assist with this later.
• If using Mac OS X, you can also configure your keychain
to automatically enter your password via HTTPS.
Connecting git with Github
• From your project directory, run `git init` to initialize
a git repository.
• Go to Github, and create a new repository with the name
of your project.
• Follow the instructions on Github to connect your
initialized git repository to the remote server on Github.
• *Please Note: you must have files in your project directory
to commit in order to push anything to your remote
server.
Basic git / Github workflow
• From your project repo on Github, navigate to the Issues tab and create a new
Issue
• From the command line, use git to create a new branch off of master to make
your edits to. To tie the branch to your issue on Github, make sure to include
the issue number after the branch name, e.g. branchName #1
• Stage edits to be committed to your git repository by using `git add <file
name>` to track the files that you want to add directly or `git add .` to
add all files at the current directory level that you have worked on.
• Commit changes using `git commit -m <message>` and be sure to leave
a short but descriptive message detailing what the commit will change when
merged to the master branch.
• Push changes to save them by using `git push origin <branch name>`
Basic git / Github workflow
• On Github, create a new pull request for the branch that you have just
pushed, and add any clarifying comments that you deem necessary.
• In order to close the issue associated with the pull request, tell
GitHub to do so by adding ‘closes <issue number>’ in the comments.
(you can also use ‘closed, fix, fixes, resolve, resolves, and resolved’
before the issue number as well).
• Github will automatically check for merge conflicts. If there are any,
check to see what they are and resolve them.
• Once everything is up to date, Github will allow you to merge using
three separate options: Merge; Squash and Merge; Rebase and
Merge.
git branching
• git branch to view current branches in repo
• git checkout -b <branch name> to create a new
branch with branch name
• git checkout <branch name> without ‘-b’ flag to
switch to existing branches
Merging vs Rebasing
• From a conceptual standpoint, git merge and git rebase
are used to achieve the same ultimate goal: to integrate
changes from one branch into another branch. There are,
however, distinct mechanics to both methods.
• We will be discussing how to use each from the context
of adding changes from your master branch into your
current working feature branch.
git merge: pros
• Generally the easiest option to merge your master branch
into your current working feature branch.
git merge: pros
• Generally the easiest option to merge your master branch
into your current working feature branch.
• You can `git checkout feature` and then `git
merge master` or you could just do it with one
command: git merge feature master
git merge: pros
• Generally the easiest option to merge your master branch
into your current working feature branch.
• You can `git checkout feature` and then `git
merge master` or you could just do it with one
command: git merge feature master
• By doing this, you create a new ‘merge commit’ in your
feature branch, which is a non-destructive operation that
ties the histories of both branches. This preserves the
exact history of your project
git merge: cons
• The branch that you merge will always have an
extraneous merge commit that will be tracked every time
you need to incorporate upstream states.
git merge: cons
• The branch that you merge will always have an
extraneous merge commit that will be tracked every time
you need to incorporate upstream states.
• In other words, it essentially creates a forked history at
the point where you merge.
git merge: cons
• The branch that you merge will always have an
extraneous merge commit that will be tracked every time
you need to incorporate upstream states.
• In other words, it essentially creates a forked history at
the point where you merge.
• This can lead to muddling the history of your branch,
thereby making it more difficult for yourself or other
developers to track the history of changes using `git
log` and/or roll back to previous states.
git rebase: pros
• To rebase, you would `git checkout feature` and
then `git rebase master`.
git rebase: pros
• To rebase, you would `git checkout feature` and
then `git rebase master`.
• Instead of creating a merge commit, rebase will move the
entire feature branch to start from the tip of the master
branch by rewriting the project history and creating brand
new commits for each commit in the original branch.
git rebase: pros
• To rebase, you would `git checkout feature` and
then `git rebase master`.
• Instead of creating a merge commit, rebase will move the
entire feature branch to start from the tip of the master
branch by rewriting the project history and creating brand
new commits for each commit in the original branch.
• The result is a singular history with no forking of the
commit history.
git rebase: cons
• Because rebase rewrites project history, you lose the
context provided by a merge commit, i.e. you won’t be
able to see when upstream changes were actually
integrated into the feature branch.
git rebase: cons
• Because rebase rewrites project history, you lose the
context provided by a merge commit, i.e. you won’t be
able to see when upstream changes were actually
integrated into the feature branch.
• More importantly, you could potentially cause extreme
difficulty by rebasing master to the tip of your feature
branch, leading git to think that your master branch’s
history has diverged from the rest
git rebase: cons
• Because rebase rewrites project history, you lose the
context provided by a merge commit, i.e. you won’t be able
to see when upstream changes were actually integrated into
the feature branch.
• More importantly, you could potentially cause extreme
difficulty by rebasing master to the tip of your feature
branch, leading git to think that your master branch’s history
has diverged from the rest
• In doing so, everyone else would still be working from the
original master branch, and both masters would need to be
merged together.
Merge conflicts
• Merge conflicts arise when two members of the same
development team work on the same file and try to merge in
their respective changes.
• The proper way to avoid merge conflicts would be to ensure that
only one branch is fully committed, pushed, and merged to
master, allowing the other branch to integrate any changes
before attempting to push and merge to master.
• If merge conflicts arise, don’t fret! Many text editors (as well as
Github) provide tools to help track down conflicts and resolve
them. Often times, it will show incoming changes juxtaposed
with the current state of your file, and allow you to choose which
to keep (one or both).

More Related Content

What's hot

Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and githubAderemi Dadepo
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHubNicolás Tourné
 
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 One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 

What's hot (20)

Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Github
GithubGithub
Github
 
Git and github
Git and githubGit and github
Git and github
 
Github basics
Github basicsGithub basics
Github basics
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git
GitGit
Git
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
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
 

Similar to Git and Github slides.pdf

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 GitRobert Lee-Cann
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthroughBimal Jain
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to GitMuhil Vannan
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-BryanLearningTech
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptxEshaan35
 

Similar to Git and Github slides.pdf (20)

Git 101
Git 101Git 101
Git 101
 
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
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Mastering GIT
Mastering GITMastering GIT
Mastering GIT
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
 
Git tips
Git tipsGit tips
Git tips
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Introduction to Git (part 2)
Introduction to Git (part 2)Introduction to Git (part 2)
Introduction to Git (part 2)
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 

Recently uploaded

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 

Recently uploaded (20)

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 

Git and Github slides.pdf

  • 1. Git and Github A developer’s best friend
  • 3. What is Git? • Git is a Version Control System (VCS) designed to make it easier to have multiple versions of a code base, sometimes across multiple developers or teams !3
  • 4. What is Git? • Git is a Version Control System (VCS) designed to make it easier to have multiple versions of a code base, sometimes across multiple developers or teams • It allows you to see changes you make to your code and easily revert them. !4
  • 5. What is Git? • Git is a Version Control System (VCS) designed to make it easier to have multiple versions of a code base, sometimes across multiple developers or teams • It allows you to see changes you make to your code and easily revert them. • It is NOT GITHUB! !5
  • 6. Ok, then what is Github? • Github.com is a website that hosts git repositories on a remote server !6
  • 7. Ok, then what is Github? • Github.com is a website that hosts git repositories on a remote server • Hosting repositories on Github facilitates the sharing of codebases among teams by providing a GUI to easily fork or clone repos to a local machine !7
  • 8. Ok, then what is Github? • Github.com is a website that hosts git repositories on a remote server • Hosting repositories on Github facilitates the sharing of codebases among teams by providing a GUI to easily fork or clone repos to a local machine • By pushing your repositories to Github, you will pretty much automatically create your own developer portfolio as well! !8
  • 9. Confirm that you have git • Open your terminal and run ‘git’ • If you see a ‘command not recognized’ error, you probably haven’t installed git yet. • We can solve your issue when the lectures are over - sit tight for now!
  • 10. Configuring git Your commits will have your name and email attached to them. To confirm that this information is correct, run the following commands: $ git config --global user.name > should be your name, i.e. Jon Rosado $ git config --global user.email > should be your email, i.e. jon.rosado42@gmail.com To fix either, just add the desired value in quotes after the command: $ git config --global user.name “Jon Rosado” $ git config --global user.email “jon.rodado42@gmail.com"
  • 11. Using Git / Github
  • 12. Connecting git with Github • In order to prevent having to enter your password each time you push up to Github, you must configure git and Github to recognize Secured Shell (SSH) keys that you generate. • To check and see if you have any recognized SSH keys active on Github, go to https://github.com/settings/keys • If you do not see any SSH keys listed, you do not have SSH configured with Github. We can assist with this later. • If using Mac OS X, you can also configure your keychain to automatically enter your password via HTTPS.
  • 13. Connecting git with Github • From your project directory, run `git init` to initialize a git repository. • Go to Github, and create a new repository with the name of your project. • Follow the instructions on Github to connect your initialized git repository to the remote server on Github. • *Please Note: you must have files in your project directory to commit in order to push anything to your remote server.
  • 14. Basic git / Github workflow • From your project repo on Github, navigate to the Issues tab and create a new Issue • From the command line, use git to create a new branch off of master to make your edits to. To tie the branch to your issue on Github, make sure to include the issue number after the branch name, e.g. branchName #1 • Stage edits to be committed to your git repository by using `git add <file name>` to track the files that you want to add directly or `git add .` to add all files at the current directory level that you have worked on. • Commit changes using `git commit -m <message>` and be sure to leave a short but descriptive message detailing what the commit will change when merged to the master branch. • Push changes to save them by using `git push origin <branch name>`
  • 15. Basic git / Github workflow • On Github, create a new pull request for the branch that you have just pushed, and add any clarifying comments that you deem necessary. • In order to close the issue associated with the pull request, tell GitHub to do so by adding ‘closes <issue number>’ in the comments. (you can also use ‘closed, fix, fixes, resolve, resolves, and resolved’ before the issue number as well). • Github will automatically check for merge conflicts. If there are any, check to see what they are and resolve them. • Once everything is up to date, Github will allow you to merge using three separate options: Merge; Squash and Merge; Rebase and Merge.
  • 16. git branching • git branch to view current branches in repo • git checkout -b <branch name> to create a new branch with branch name • git checkout <branch name> without ‘-b’ flag to switch to existing branches
  • 17. Merging vs Rebasing • From a conceptual standpoint, git merge and git rebase are used to achieve the same ultimate goal: to integrate changes from one branch into another branch. There are, however, distinct mechanics to both methods. • We will be discussing how to use each from the context of adding changes from your master branch into your current working feature branch.
  • 18. git merge: pros • Generally the easiest option to merge your master branch into your current working feature branch.
  • 19. git merge: pros • Generally the easiest option to merge your master branch into your current working feature branch. • You can `git checkout feature` and then `git merge master` or you could just do it with one command: git merge feature master
  • 20. git merge: pros • Generally the easiest option to merge your master branch into your current working feature branch. • You can `git checkout feature` and then `git merge master` or you could just do it with one command: git merge feature master • By doing this, you create a new ‘merge commit’ in your feature branch, which is a non-destructive operation that ties the histories of both branches. This preserves the exact history of your project
  • 21. git merge: cons • The branch that you merge will always have an extraneous merge commit that will be tracked every time you need to incorporate upstream states.
  • 22. git merge: cons • The branch that you merge will always have an extraneous merge commit that will be tracked every time you need to incorporate upstream states. • In other words, it essentially creates a forked history at the point where you merge.
  • 23. git merge: cons • The branch that you merge will always have an extraneous merge commit that will be tracked every time you need to incorporate upstream states. • In other words, it essentially creates a forked history at the point where you merge. • This can lead to muddling the history of your branch, thereby making it more difficult for yourself or other developers to track the history of changes using `git log` and/or roll back to previous states.
  • 24. git rebase: pros • To rebase, you would `git checkout feature` and then `git rebase master`.
  • 25. git rebase: pros • To rebase, you would `git checkout feature` and then `git rebase master`. • Instead of creating a merge commit, rebase will move the entire feature branch to start from the tip of the master branch by rewriting the project history and creating brand new commits for each commit in the original branch.
  • 26. git rebase: pros • To rebase, you would `git checkout feature` and then `git rebase master`. • Instead of creating a merge commit, rebase will move the entire feature branch to start from the tip of the master branch by rewriting the project history and creating brand new commits for each commit in the original branch. • The result is a singular history with no forking of the commit history.
  • 27. git rebase: cons • Because rebase rewrites project history, you lose the context provided by a merge commit, i.e. you won’t be able to see when upstream changes were actually integrated into the feature branch.
  • 28. git rebase: cons • Because rebase rewrites project history, you lose the context provided by a merge commit, i.e. you won’t be able to see when upstream changes were actually integrated into the feature branch. • More importantly, you could potentially cause extreme difficulty by rebasing master to the tip of your feature branch, leading git to think that your master branch’s history has diverged from the rest
  • 29. git rebase: cons • Because rebase rewrites project history, you lose the context provided by a merge commit, i.e. you won’t be able to see when upstream changes were actually integrated into the feature branch. • More importantly, you could potentially cause extreme difficulty by rebasing master to the tip of your feature branch, leading git to think that your master branch’s history has diverged from the rest • In doing so, everyone else would still be working from the original master branch, and both masters would need to be merged together.
  • 30. Merge conflicts • Merge conflicts arise when two members of the same development team work on the same file and try to merge in their respective changes. • The proper way to avoid merge conflicts would be to ensure that only one branch is fully committed, pushed, and merged to master, allowing the other branch to integrate any changes before attempting to push and merge to master. • If merge conflicts arise, don’t fret! Many text editors (as well as Github) provide tools to help track down conflicts and resolve them. Often times, it will show incoming changes juxtaposed with the current state of your file, and allow you to choose which to keep (one or both).