Skip to content

Initial Set Up of a git repository

Franco Pestilli edited this page Jul 24, 2015 · 5 revisions

Please note that you will need to complete these only once for each machine.

1. Install git on your machine from above.

2. Create an account on Github.

3. Go to the https://github.com/frakkopesto/life Page.

4. Create a 'Fork' into your own repository.

5. Go to your own folder (for example, ~/matlab/git/) and clone this into your local machine so you have it locally.

  git clone https://github.com/(YOUR USERNAME)/life.git

6. Cd into the repository that you just created.

  cd life

7. Set up an 'upstream' pointer to the online repository. THis will require setting up correctly your github user account (see appropriate section).

  git config --global user.name "francopestilli"
  git config --global user.email [email protected]

Add the upstream pointing to the online repository using yoru user:

  git remote add upstream https://[email protected]/brain-life/life.git

8. When you want to make a change to the code, create a branch for your changes.

  git branch [new branch name]

9. Move into your new branch.

  git checkout [new branch name]

10. Make any changes that you want.

  some code here

11. Commit your changes to your branch

  git commit -am "Your Message Here"

12. Now, let's push the local changes that you have on your computer up to github so that it is saved there.

  git push origin [new branch name]

You can now see your branch and all of your changes on github. When you are ready for this code to be integrated into frakkopesto/life, issue a pull request. This completes making the local repository on your machine. When you visit the web-page of the newly-created repository, it will contain the complete constructions of adding your branch to github. After you have added it (the first time), you can easily push any new changes that you have committed with the next line.