Last active
August 29, 2015 14:27
-
-
Save Technicus/8e223c87bf5db639cd04 to your computer and use it in GitHub Desktop.
The basics of Git: < http://git-scm.com/book >
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| First you need to set up the remote and local repo and link them together. | |
| This is assuming you've already installed git. | |
| Make a repo on github or bitbucket, I prefer github, but bitbucket offers private repos for free. | |
| This will give you a repo address, looks a lot like a web address. | |
| Initialize the local repo: go to your project folder in a terminal and | |
| type | |
| git init | |
| Then run | |
| git remote add origin <your repo address> | |
| refer to this: https://help.github.com/articles/adding-a-remote | |
| After that you can push to the remote repo, these commands you'll get familiar with. | |
| git status will show you the files in the directory not committed (on your first set up it should show everything) | |
| git add . or git add -A will get files ready to be committed. | |
| The dot adds everything and removes nothing (I use it the most), the -A will tell it to remove remote files no longer found locally. | |
| I only use the -A flag when I know I need to remove old files from the remote. | |
| git commit -m 'your note that explains what has changed' will commit the files from add. | |
| There is a lot of debate here on when to commit. I like to commit often and at logical breaks, like when something is done. | |
| In real life that doesn't happen. | |
| I find myself doing one giant commit for work done that day. | |
| finally run | |
| git push origin master to put your code on the remote repo. | |
| You can run commit multiple times, then do one push if you like too. T | |
| here are also ways to set it up so you can just run git push. | |
| There is a free git book full of great info, http://git-scm.com/book | |
| but it can be hard to follow imo. | |
| Hope this helps some. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment