Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RedSoxFan22/72a572425f3bd0540027060ee9413cf2 to your computer and use it in GitHub Desktop.
Save RedSoxFan22/72a572425f3bd0540027060ee9413cf2 to your computer and use it in GitHub Desktop.
Git/GitHub
Git is a version control system, a tool to manage all the different versions of your code. GitHub is an online hosting service for your git repositories.
When you start a project, you want to 1. create a file locally (in C9), 2. create a new repository in GitHub** 3. connect the two
That’s (mostly) it.
**Check out this 1-minute tutorial on how to create a new repo on GitHub: https://www.youtube.com/watch?v=LR5BYZjuXMU
When working with Git, commands to commit (pun intended!) to heart:
Open your project folder, and in the terminal, enter the following:
1. git init
a. you only need this command the very first time you commit a project. This is for the initial commit, that’s it.
2. git add .
a. don’t forget the period at the end of this command.
3. git commit –m “I made the following changes…”
a. What changed in this file? Commit messages might be something like: “added a method to reverse the string”; “changed the background color”; “added comments to the code”;
4. git remote add origin <add path>
You can get the path from the repository you made on github. It will look something like this:
git@github.com:RedSoxFan22/Saturday2.git
or
https://github.com/RedSoxFan22/Saturday2.git
5. git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment