More resources coming soon...
Github Submodule Setup
Think of a submodule as a github repo inside another github repo (I know, woah). Here's how things will generally be set up:
Ok, but what about more instructions with examples you say?
2. Create & clone your own repo
Do all your work in this repo.
3. Clone the main repo
Change into the correct directory and add your repo as a submodule
Commit and push changes
You do not have to pull first, but it is a good idea in case anyone has pushed before you have a chance to.
Remove the main repo and go about your business
Using Git/Github: The basics
Cloning an existing project:
For every assignment, you will need to clone the project repository You should only do this once per repository per computer. After you clone, the project directory will be downloaded onto your computer and all future git changes must be made inside that directory.
use the following command to checkout:
for example, to checkout an assignment called hw1 I would do the following:
This will create a folder on your computer called (in this case) hw1. You must go into that folder to add your own directory.
Creating your own directory within a project:
Once you have cloned the assignment, create a directory for yourself. Change into the assignment folder and make a new directory with the name: Firstname_Lastname. So mine would be JonAlf_Dyrland-Weaver. After you create the directory add it to the main repository and commit (see the instructions for adding and committing below)
So to make my own repository to the project called hw1 from above:
Once you make, add and commit the directory do all your work within the directory
When you create a new file, it is not automatically tracked by git. You must tell git which files it should track. (This is useful because you don't want to add .o, ~ and executable files that may get created while working on your project, you may also look at .gitignore for more ways to keep out unwanted files). You only need to do this once per file. After it has been added git will track it. You cannot add an empty folder. Make sure you put something in a folder in order to add the whole thing
You will not see any response after adding a file
Running git rm will also remove the file from your directory immediately
Committing your changes:
When you add files, the changes are not automatically saved but git, you must commit these changes. You must always use the -m option followed by a string containing a commit message. You should commit anytime you have changes that are worth saving!
The -a option will automatically commit any changes to files that you have already added. You should always include -a (unless you know what you're in for)
Pushing your changes to gihub
Committing is a local operation, it will not change the status of your work on gihub. You do this with the push command. When pushing, git may ask you for your username and password, (use your github account information) depending on how you have git set up.
Updating your project to the latest version:
When you start working in a new location (i.e. you worked in school, pushed your changes and now want to work at home with the latest version), pull any changes from github. This will make all of your files match with those on github.