Hey Pierce, this is not really a tutorial more like a guide on how - at least - I use GIT. I'm going to assume you have GIT installed on your computer.
As you may now GIT 'projects' are called repositories, to get one on your computer you basicly have two options.
If you have an existing repo on your computer or online (e.g. github) that you want as a base for your new project you can clone it by using git clone path
.
If it's a local repo on your computer you can do something like:
git clone path/to/git/project
And if it's online then you just need to get the repo address (on github it's the textbox near the top), for example:
git clone https://github.com/gmanricks/PHP-GIT-Hooks
If you are just creating a new project and you don't want to start from something else, then just navigate to the desired folder (in the GIT terminal) and type git init
.
Just adding files to the GIT folder will not add them to the repo. You need to tell GIT to track them, this can be done by specifying each file manually using git add file_name
or by typing git add .
to add all files.
If their are certain files you do not want tracked at all, you can create a file in the root of your project named .gitignore
and add the names of the files you want it to ignore (one name per line).
Once you have worked on your project and you want to commit the changes, you can type git commit -am "Commit Message"
to log the current state into the GIT repo. You can also type git status
to see if there are any changes un-commited or new files that are not being tracked.
If you want to put your project online, let's say on github, you can create a new repo (on github) and you will get the SSH adrress for it. Once everything is setup their (you give them your public key for authorization) you will be able to add their link to your project and push to it.
To add the link just type git remote add name link
so something like git remote add github git@github.com:gmanricks/PHP-GIT-Hooks.git
.
Once that is done, you can push you're latest commits by typing git push name master
or - following the above example - git push github master
.
'master' is the name of the default branch, but that's a little more advanced when you start needing multiple branches to manage different users / features.
I hope this helps !