If you need to: create an account in github and learn the basics with the basic github resources and a cheat sheet.
Github provides free account upgrades to students and anyone working at a educational/research institute, which allow you to have your own private repositories. To get this upgrade, once you have a personal account, go to this page and fill in the form: https://education.github.com/discount_requests/new
The recommended steps to contribute to a repository are:
- Fork and clone: Get a copy from the GitHub repository
- Update your personal copy
- Track upstream: keeping your copy up-to-date with the main one
- Steps to follow when working on a new (big) feature: Branch, Contribute, Commit, (Merge) and Push.
- Submit a Pull Request to the main a repository code.
Once you have your GitHub account and are familiar with the basic git vocabulary, create your own a repository copy:
-
Go to https://github.com/BatLabLancaster/[repo name]
-
Click 'Fork' there (right upper corner).
The next step is to get your copy of the repository onto your computer:
-
In your computer, go to your home directory (or wherever you want to have the repository).
-
Clone there the repository, from your OWN local repository:
git clone https://[git username]@github.com/[git username]/[batlab repo name]
You'll be prompt for your GitHub username and password.
Ensure that the remote is the correct one:
git remote -v
If you need to reset the remote link:
git remote set-url origin https://[git username]@github.com/[git username]/[git repository]
Update your personal copy:
git push origin master
This instructions follow the recommendations on syncing a fork from GitHub. To make sure that your version remains up to date with the master version, set the upstream tracking on the command line:
git remote add --track master upstream https://[git username]@github.com/BatLabLancaster/[batlab repo name]
Now, every time you need to apply the changes that have been made to the master version to yours, navigate to your a repository directory and run on the command line:
git fetch upstream
git merge upstream/master
To start working on new feature, create a separate feature branch:
git checkout -b feature
You can check the branches you have by:
git branch
And switch between them with:
git checkout master
git checkout feature
Once some changes have been made in the branch, stage them and commit:
git add .
git commit -m "Add a comment here"
You can push changes with:
git push origin feature
Alternatively, you can merge the changes with the master branch first, and then push:
git checkout master
git merge feature
git push origin master
When you are ready to update the main a repository code, go to your GitHub repository page, click "New pull request" to create a Pull Request from your latest commit. It will be applied by someone with administrator master version rights after review.