SlideShare a Scribd company logo
INTRODUCTION TO
GIT / GITHUB
Paige Bailey
PyLadies-HTX
January 7th, 2015
ROADMAP
INTRODUCTIONS!
 Command Line Interface
 Installing and Configuring Git
 Registering for GitHub
 Creating a GitHub Repository
 Basic Git Commands
COMMAND LINE INTERFACE (CLI)
 Windows: Git Bash
 Mac / Linux: Terminal
 The CLI can help you:
 Navigate folders
 Create files, folders, and programs
 Edit files, folders, and programs
 Run computer programs
DIRECTORIES
 “Directory” is just another name for a
folder (like the folders you see in
Windows and on your Mac)
 Directories are organized like a tree
 Directories can be inside other
directories (just like you can have
folders in folders)
 Directories can be navigated using
the CLI
ASUS/Dropbox/share
Bret_Victor… CUPS DataViz MIT_OCW
DIRECTORIES
 The “MIT_OCW” directory is
contained inside of the “share”
directory, which is within the
“Dropbox” directory
 One directory “up” from the
“MIT_OCW” directory is the “share”
directory
ASUS/Dropbox/share
Bret_Victor… CUPS DataViz MIT_OCW
DIRECTORY STRUCTURES
 The directory structure on your computer probably looks something like this:
/
Users Apps
Paige ~ Games Utilities
Pictures Books Pictures
SPECIAL DIRECTORIES: ROOT
 The directory at the top of the tree is called the “root” directory
 “root” contains all the other directories; it is represented by a slash “/”
/
Users Apps
Paige ~ Games Utilities
Pictures Books Pictures
SPECIAL DIRECTORIES: HOME
 The name you use to log in to your computer; represented by a tilde symbol “~”
 Contains most of your personal files: pictures and music and such
/
Users Apps
Paige ~ Games Utilities
Pictures Books Pictures
NAVIGATING DIRECTORIES
 For Windows:
 Open up the “Start” menu
 Search for “git bash”
 Open Git Bash
 For Mac computers:
 Open up Spotlight
 Search for “terminal”
 Open up theTerminal
CLI BASICS
 When you open Git Bash, or aTerminal, you’ll see a prompt which should look
something like the picture you see below
 Your computer’s name, then your username, then a $
 This is your home directory, and currently it is your “working directory”
CLI BASICS
 You can imagine tracing all of the directories from “root” to “home” (your “path”)
/
Users Apps
Paige ~ Games Utilities
Pictures Books Pictures
CLI BASICS
 Type pwd in your CLI prompt and press enter
 This displays the path to your “working directory” (the directory that you’re
currently in). Stands for “print working directory”.
 That’s the same path that we just traced on the file structure tree
CLI COMMAND RECIPE
 command flags arguments
 command is the CLI command which does a specific task
 flags are options we give to the command for behaviors, preceded by a dash “-”
 arguments: what the command modifies, or other options for command
 There can be zero or more flags or arguments for each command
 Example: pwd is a command that had zero flags or arguments
COMMON COMMANDS
pwd Displays the path to the current working directory
clear Clears out the commands that you currently have displayed in the CLI
ls Lists files and folders in the current directory
ls –a Lists hidden and unhidden files and folders (“-a” is a flag)
ls –al Lists details for hidden and unhidden files and folders (“-l” is a flag)
cd Takes you to your home directory.Takes as an argument the directory you want to visit.
cd .. Go up one directory
mkdir Makes a directory; takes as an argument the folder you want to make
touch Creates an empty file (argument is the file name)
cp Copy; first argument is a file, second argument is the path where you want the file to be copied. Use the flag “-r”
to copy a directory.
rm Remove; argument is the file you want to remove.The flag “-r” can remove a directory.
date Prints today’s date.
echo Prints out to the CLI whatever arguments you provide
COMMON COMMANDS
pwd Displays the path to the current working directory
clear Clears out the commands that you currently have displayed in the CLI
ls Lists files and folders in the current directory
ls –a Lists hidden and unhidden files and folders (“-a” is a flag)
ls –al Lists details for hidden and unhidden files and folders (“-l” is a flag)
cd Takes you to your home directory.Takes as an argument the directory you want to visit.
cd .. Go up one directory
mkdir Makes a directory; takes as an argument the folder you want to make
touch Creates an empty file (argument is the file name)
cp Copy; first argument is a file, second argument is the path where you want the file to be copied. Use the flag “-r”
to copy a directory.
rm Remove; argument is the file you want to remove.The flag “-r” can remove a directory.
date Prints today’s date.
echo Prints out to the CLI whatever arguments you provide
VERSION CONTROL
Version control is a system that records
changes to a file or set of files over time so
that you can recall specific versions later.
 Many of us constantly create something, save it, change it, then save it again
 Version (or revision) control is a means of managing this process in a reliable and
efficient way
 Especially important when collaborating with others
GIT
Git is a free and open-source distributed version control
system designed to handle everything from small to
very large projects with speed and efficiency.
 Created by the same people who developed Linux
 The most popular implementation of version control today
 Everything is stored in local repositories (“repos”) on your computer
 Operated from the command line
DOWNLOAD AND INSTALL GIT
 http://git-scm.com/downloads
 Click on the download link for your computer (Mac, Linux, Windows)
DOWNLOAD AND INSTALL GIT
 Once the file is downloaded, open it up and begin the installation process
 Just go with the defaults, and then open up Git Bash
CONFIGURE USERNAME AND EMAIL
 Each commit to a Git repository will be “tagged” with the username of the person
who made the commit
 Enter the following commands in Git Bash, one at a time, to set your username
and email. Make sure you remember which email you used – that’ll be the one
we’ll need to use to register for GitHub.
 Type git config –list afterward, to make sure your changes were made
GITHUB
GitHub is a web-based hosting service for
software development projects that use the Git
revision control system.
 Allows users to “push” and “pull” their local repositories to and from remote
repositories on the web
 Provides users with a homepage that displays public repos
 Repos are backed up on GitHub servers in case something happens to local files
 Can follow other folks online and share projects
GITHUB
 https://github.com
 Enter in a username, email, and password, and click “Sign up for Github”.
 Use a .edu address if you’ve got access to one!
GITVS. GITHUB
 Git is local on your computer
 GitHub is available via the internet (“remote”)
 GitHub allows you to:
 Share your repos with others
 Access other users’ repositories
 Store remote copies of your repositories on GitHub’s server in case something bad
happens to the local copies on your computer
 You don’t need GitHub to use git
CREATING A GITHUB REPOSITORY
 Two methods of creating a GitHub repository:
 Start a repository from scratch
 “Fork” another user’s repository
 https://github.com/YourUserName --> “Create a new repo”
 https://github.com/new (if you’re logged into your GitHub account)
 Create a name for the repo; select “Public”; make a brief description; initialize
with a README; and click “Create repository” button.
MAKE A REPO
CREATING A LOCAL COPY
 Now you need to create a copy of this repository on your computer so that you
can make changes to it!
 Open Git Bash
 Create a directory on your computer to store your copy of the repo
 Navigate to this new directory using “cd”
CREATING A LOCAL COPY
 Initialize a local Git repository in this directory with “git init”
 Point your local repository at the remote repository you just created on the
GitHub server
FORKING ANOTHER USER’S REPO
 The second method of creating a repository is to make a copy of someone else’s.
 This process is called “forking” and is an important aspect of open-source
software development.
 Let’s fork my “PyLadiesHTX” directory:
CLONETHE REPO
 So there’s a copy of the repository in your GitHub account now…
 …but you still need to make a local copy on your computer.
 This is called “cloning”. You can do it with the following command:
PUSHING AND PULLING
ADDING
 If you add new files to a local repository (a directory that’s just housed on your
computer, not on the internet) you need to let Git know that they need to be
tracked.
 This should always be done before committing.
git add . Adds all new files
git add –u Updates tracking for files that
changed names or were deleted
git add –A Does both of the previous steps
COMMITTING AND PUSHING
 If you want to commit changes to your local repository, you use the following
command:
 To push those local changes to GitHub, you’d use the command:
BRANCHES
 Sometimes you’re working on a project with a version that’s being used by a lot of
different people
 You might not want to edit the version that everyone’s editing – so you can branch
off a copy of the repo with the command:
 To see what branch you’re on, type:
 To switch back to the master branch type:
PULL REQUESTS
 If you fork someone’s repo or have multiple branches, you will both be working
separately
 Sometimes you want to merge in your changes with the other branch / repo
 To do so, you need to send in a “pull request” (feature of GitHub)
 Extra resources:
 http://git-scm.com/doc
 https://help.github.com
 Google it! Or use StackOverflow
THANKYOU!
PyLadies-HTX 2015

More Related Content

KEY
The everyday developer's guide to version control with Git
PPTX
Git 101 for Beginners
PPTX
Workshop on Git and GitHub
PDF
Git and Github slides.pdf
PDF
Git and github - Verson Control for the Modern Developer
PDF
Git and github 101
PPT
Introduction to Git and Github
PPTX
Git and GitHub
The everyday developer's guide to version control with Git
Git 101 for Beginners
Workshop on Git and GitHub
Git and Github slides.pdf
Git and github - Verson Control for the Modern Developer
Git and github 101
Introduction to Git and Github
Git and GitHub

What's hot (20)

PPT
Version Control
PDF
Git real slides
PPTX
Introduction to git and github
PDF
Git - An Introduction
PDF
Introduction to Git
PDF
Advanced Git Tutorial
PDF
Git training v10
PDF
Version Control System - Git
PPTX
GitHub Basics - Derek Bable
PDF
Starting with Git & GitHub
PPTX
Git One Day Training Notes
PDF
Learning git
PPTX
Git - Basic Crash Course
PPTX
Introduction git
PPT
Git basic
PPTX
Git & GitLab
PDF
Git Introduction Tutorial
PDF
Git basics
PDF
Git and git flow
Version Control
Git real slides
Introduction to git and github
Git - An Introduction
Introduction to Git
Advanced Git Tutorial
Git training v10
Version Control System - Git
GitHub Basics - Derek Bable
Starting with Git & GitHub
Git One Day Training Notes
Learning git
Git - Basic Crash Course
Introduction git
Git basic
Git & GitLab
Git Introduction Tutorial
Git basics
Git and git flow
Ad

Viewers also liked (8)

PDF
Intro to Git and GitHub
PPTX
ESCI 452 - Final Project(s)
PPTX
PyLadies-HTX: First Meetup!
PPTX
Python 101++: Let's Get Down to Business!
PDF
Git Notes and GitHub
PPTX
I ♥ Maps: Quantum GIS + Python
PPTX
Python 101: Python for Absolute Beginners (PyTexas 2014)
PDF
Learn 90% of Python in 90 Minutes
Intro to Git and GitHub
ESCI 452 - Final Project(s)
PyLadies-HTX: First Meetup!
Python 101++: Let's Get Down to Business!
Git Notes and GitHub
I ♥ Maps: Quantum GIS + Python
Python 101: Python for Absolute Beginners (PyTexas 2014)
Learn 90% of Python in 90 Minutes
Ad

Similar to Introduction to Git / Github (20)

PDF
Github and Git What the fuck is this shit .pdf
PDF
AIS Technical Development Workshop 3: Getting Started with Git and GitHub
PPTX
PPTX
Hello Git
PPTX
Untangling fall2017 week2
PPTX
Untangling fall2017 week2_try2
PDF
Formation git
PPTX
GitHub Event.pptx
PPTX
Github Session organized by GDG on campus SCOE.pptx
PDF
GIT_GITHUB_2016_06_17
PDF
Getting started With GIT
PPTX
tech winter break workshop on git &git hub.pptx
PPTX
Git and GitHub
PDF
[artifactconf] Github for People Who Don't Code
PPTX
Introduction to git hub
PPTX
Setting up Git.pptx
PDF
git-commands-cheat-sheet-infopediya-com.pdf
PPTX
Git ritesh venture_pact
PDF
Github and Git What the fuck is this shit .pdf
AIS Technical Development Workshop 3: Getting Started with Git and GitHub
Hello Git
Untangling fall2017 week2
Untangling fall2017 week2_try2
Formation git
GitHub Event.pptx
Github Session organized by GDG on campus SCOE.pptx
GIT_GITHUB_2016_06_17
Getting started With GIT
tech winter break workshop on git &git hub.pptx
Git and GitHub
[artifactconf] Github for People Who Don't Code
Introduction to git hub
Setting up Git.pptx
git-commands-cheat-sheet-infopediya-com.pdf
Git ritesh venture_pact

Recently uploaded (20)

PDF
Advanced Soft Computing BINUS July 2025.pdf
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Modernizing your data center with Dell and AMD
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Electronic commerce courselecture one. Pdf
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
Sensors and Actuators in IoT Systems using pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced Soft Computing BINUS July 2025.pdf
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Advanced methodologies resolving dimensionality complications for autism neur...
Modernizing your data center with Dell and AMD
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
Transforming Manufacturing operations through Intelligent Integrations
NewMind AI Weekly Chronicles - August'25 Week I
NewMind AI Monthly Chronicles - July 2025
Electronic commerce courselecture one. Pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Understanding_Digital_Forensics_Presentation.pptx
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
Sensors and Actuators in IoT Systems using pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Introduction to Git / Github

  • 1. INTRODUCTION TO GIT / GITHUB Paige Bailey PyLadies-HTX January 7th, 2015
  • 2. ROADMAP INTRODUCTIONS!  Command Line Interface  Installing and Configuring Git  Registering for GitHub  Creating a GitHub Repository  Basic Git Commands
  • 3. COMMAND LINE INTERFACE (CLI)  Windows: Git Bash  Mac / Linux: Terminal  The CLI can help you:  Navigate folders  Create files, folders, and programs  Edit files, folders, and programs  Run computer programs
  • 4. DIRECTORIES  “Directory” is just another name for a folder (like the folders you see in Windows and on your Mac)  Directories are organized like a tree  Directories can be inside other directories (just like you can have folders in folders)  Directories can be navigated using the CLI ASUS/Dropbox/share Bret_Victor… CUPS DataViz MIT_OCW
  • 5. DIRECTORIES  The “MIT_OCW” directory is contained inside of the “share” directory, which is within the “Dropbox” directory  One directory “up” from the “MIT_OCW” directory is the “share” directory ASUS/Dropbox/share Bret_Victor… CUPS DataViz MIT_OCW
  • 6. DIRECTORY STRUCTURES  The directory structure on your computer probably looks something like this: / Users Apps Paige ~ Games Utilities Pictures Books Pictures
  • 7. SPECIAL DIRECTORIES: ROOT  The directory at the top of the tree is called the “root” directory  “root” contains all the other directories; it is represented by a slash “/” / Users Apps Paige ~ Games Utilities Pictures Books Pictures
  • 8. SPECIAL DIRECTORIES: HOME  The name you use to log in to your computer; represented by a tilde symbol “~”  Contains most of your personal files: pictures and music and such / Users Apps Paige ~ Games Utilities Pictures Books Pictures
  • 9. NAVIGATING DIRECTORIES  For Windows:  Open up the “Start” menu  Search for “git bash”  Open Git Bash  For Mac computers:  Open up Spotlight  Search for “terminal”  Open up theTerminal
  • 10. CLI BASICS  When you open Git Bash, or aTerminal, you’ll see a prompt which should look something like the picture you see below  Your computer’s name, then your username, then a $  This is your home directory, and currently it is your “working directory”
  • 11. CLI BASICS  You can imagine tracing all of the directories from “root” to “home” (your “path”) / Users Apps Paige ~ Games Utilities Pictures Books Pictures
  • 12. CLI BASICS  Type pwd in your CLI prompt and press enter  This displays the path to your “working directory” (the directory that you’re currently in). Stands for “print working directory”.  That’s the same path that we just traced on the file structure tree
  • 13. CLI COMMAND RECIPE  command flags arguments  command is the CLI command which does a specific task  flags are options we give to the command for behaviors, preceded by a dash “-”  arguments: what the command modifies, or other options for command  There can be zero or more flags or arguments for each command  Example: pwd is a command that had zero flags or arguments
  • 14. COMMON COMMANDS pwd Displays the path to the current working directory clear Clears out the commands that you currently have displayed in the CLI ls Lists files and folders in the current directory ls –a Lists hidden and unhidden files and folders (“-a” is a flag) ls –al Lists details for hidden and unhidden files and folders (“-l” is a flag) cd Takes you to your home directory.Takes as an argument the directory you want to visit. cd .. Go up one directory mkdir Makes a directory; takes as an argument the folder you want to make touch Creates an empty file (argument is the file name) cp Copy; first argument is a file, second argument is the path where you want the file to be copied. Use the flag “-r” to copy a directory. rm Remove; argument is the file you want to remove.The flag “-r” can remove a directory. date Prints today’s date. echo Prints out to the CLI whatever arguments you provide
  • 15. COMMON COMMANDS pwd Displays the path to the current working directory clear Clears out the commands that you currently have displayed in the CLI ls Lists files and folders in the current directory ls –a Lists hidden and unhidden files and folders (“-a” is a flag) ls –al Lists details for hidden and unhidden files and folders (“-l” is a flag) cd Takes you to your home directory.Takes as an argument the directory you want to visit. cd .. Go up one directory mkdir Makes a directory; takes as an argument the folder you want to make touch Creates an empty file (argument is the file name) cp Copy; first argument is a file, second argument is the path where you want the file to be copied. Use the flag “-r” to copy a directory. rm Remove; argument is the file you want to remove.The flag “-r” can remove a directory. date Prints today’s date. echo Prints out to the CLI whatever arguments you provide
  • 16. VERSION CONTROL Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.  Many of us constantly create something, save it, change it, then save it again  Version (or revision) control is a means of managing this process in a reliable and efficient way  Especially important when collaborating with others
  • 17. GIT Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.  Created by the same people who developed Linux  The most popular implementation of version control today  Everything is stored in local repositories (“repos”) on your computer  Operated from the command line
  • 18. DOWNLOAD AND INSTALL GIT  http://git-scm.com/downloads  Click on the download link for your computer (Mac, Linux, Windows)
  • 19. DOWNLOAD AND INSTALL GIT  Once the file is downloaded, open it up and begin the installation process  Just go with the defaults, and then open up Git Bash
  • 20. CONFIGURE USERNAME AND EMAIL  Each commit to a Git repository will be “tagged” with the username of the person who made the commit  Enter the following commands in Git Bash, one at a time, to set your username and email. Make sure you remember which email you used – that’ll be the one we’ll need to use to register for GitHub.  Type git config –list afterward, to make sure your changes were made
  • 21. GITHUB GitHub is a web-based hosting service for software development projects that use the Git revision control system.  Allows users to “push” and “pull” their local repositories to and from remote repositories on the web  Provides users with a homepage that displays public repos  Repos are backed up on GitHub servers in case something happens to local files  Can follow other folks online and share projects
  • 22. GITHUB  https://github.com  Enter in a username, email, and password, and click “Sign up for Github”.  Use a .edu address if you’ve got access to one!
  • 23. GITVS. GITHUB  Git is local on your computer  GitHub is available via the internet (“remote”)  GitHub allows you to:  Share your repos with others  Access other users’ repositories  Store remote copies of your repositories on GitHub’s server in case something bad happens to the local copies on your computer  You don’t need GitHub to use git
  • 24. CREATING A GITHUB REPOSITORY  Two methods of creating a GitHub repository:  Start a repository from scratch  “Fork” another user’s repository  https://github.com/YourUserName --> “Create a new repo”  https://github.com/new (if you’re logged into your GitHub account)  Create a name for the repo; select “Public”; make a brief description; initialize with a README; and click “Create repository” button.
  • 26. CREATING A LOCAL COPY  Now you need to create a copy of this repository on your computer so that you can make changes to it!  Open Git Bash  Create a directory on your computer to store your copy of the repo  Navigate to this new directory using “cd”
  • 27. CREATING A LOCAL COPY  Initialize a local Git repository in this directory with “git init”  Point your local repository at the remote repository you just created on the GitHub server
  • 28. FORKING ANOTHER USER’S REPO  The second method of creating a repository is to make a copy of someone else’s.  This process is called “forking” and is an important aspect of open-source software development.  Let’s fork my “PyLadiesHTX” directory:
  • 29. CLONETHE REPO  So there’s a copy of the repository in your GitHub account now…  …but you still need to make a local copy on your computer.  This is called “cloning”. You can do it with the following command:
  • 31. ADDING  If you add new files to a local repository (a directory that’s just housed on your computer, not on the internet) you need to let Git know that they need to be tracked.  This should always be done before committing. git add . Adds all new files git add –u Updates tracking for files that changed names or were deleted git add –A Does both of the previous steps
  • 32. COMMITTING AND PUSHING  If you want to commit changes to your local repository, you use the following command:  To push those local changes to GitHub, you’d use the command:
  • 33. BRANCHES  Sometimes you’re working on a project with a version that’s being used by a lot of different people  You might not want to edit the version that everyone’s editing – so you can branch off a copy of the repo with the command:  To see what branch you’re on, type:  To switch back to the master branch type:
  • 34. PULL REQUESTS  If you fork someone’s repo or have multiple branches, you will both be working separately  Sometimes you want to merge in your changes with the other branch / repo  To do so, you need to send in a “pull request” (feature of GitHub)  Extra resources:  http://git-scm.com/doc  https://help.github.com  Google it! Or use StackOverflow