SlideShare une entreprise Scribd logo
1  sur  35
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

Contenu connexe

Tendances

Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 

Tendances (20)

Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
Git slides
Git slidesGit slides
Git slides
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git
GitGit
Git
 
Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Git commands
Git commandsGit commands
Git commands
 
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
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Git training v10
Git training v10Git training v10
Git training v10
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 

En vedette

En vedette (8)

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

Similaire à Introduction to Git / Github

Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
Derek Jacoby
 

Similaire à Introduction to Git / Github (20)

1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
Git
GitGit
Git
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Fewd week1 slides
Fewd week1 slidesFewd week1 slides
Fewd week1 slides
 
Git
GitGit
Git
 
Git
GitGit
Git
 
Git hub
Git hubGit hub
Git hub
 
git.ppt
git.pptgit.ppt
git.ppt
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Make an Instant Website with Webhooks
Make an Instant Website with WebhooksMake an Instant Website with Webhooks
Make an Instant Website with Webhooks
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
 
Git
GitGit
Git
 
August OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub ExplainedAugust OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub Explained
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
git & GitHub workshop
git & GitHub workshopgit & GitHub workshop
git & GitHub workshop
 
Git/GitHub
Git/GitHubGit/GitHub
Git/GitHub
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

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