SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (20)

Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
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 | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Github
GithubGithub
Github
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Version control system and Git
Version control system and GitVersion control system and Git
Version control system and Git
 
Git basic
Git basicGit basic
Git basic
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
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 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
git and github
git and githubgit and github
git and github
 

Destaque

Destaque (9)

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

Semelhante a Introduction to Git / Github

Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
Derek Jacoby
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocido
Luis Bertel
 

Semelhante a 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
 
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
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocido
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

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