Git and GitHub: A Quick Reference #14
personalizedrefrigerator
started this conversation in
Today I Learn
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Git and GitHub
This document is intended for students who participated in the Packtober Rest event (in October) and want a quick reference on how to use
git
andGitHub
.Moving an Existing Project to GitHub
Let's say we have an existing project called
foo
that we want to upload to GitHub.To do this:
New
, the button just to the right ofRepositories
Create repository
(you may also want to choose a license)Ctrl+`
)git
yet,git init .
in the project's root directorygit add .
to add all files in the current directory (which is represented by.
) togit
.git commit -m "a description of the commit here"
. Note that-m
stands for--message
.Cloning an Existing Repository
First, let's get the repository's clone URL:

From here, the repository can be cloned either from a graphical frontend for
git
or from the command line:From the command line
To get a copy of a repository on your computer, we use the
git clone
command!Git Bash
.cd
command changes the directory the terminal is in. Thels
command lists the files in the current directory. Use these commands to move to the location you want to save the code from the repository.git clone <url>
command, pasting the repository's clone URL copied above (on some terminals, paste isCtrl+Shift+V
):You've cloned the repository!
From VSCode
File > New Window
first if you're currently in a project):open
!Pushing Changes to GitHub
From VSCode
From the command line
git
(letgit
know that files might have changed)Contributing to a Project
fork
the project).Contribute
(be sure to commit and push first!)Git Resources
Beta Was this translation helpful? Give feedback.
All reactions