Skip to content

Getting Started with GitHub

Steve Penny edited this page Jun 8, 2017 · 4 revisions

Fork the Ocean-LETKF repository to your own github account.
(Look for the button near the top right of this page: https://github.com/UMD-AOSC/Ocean-LETKF)
(Also, you can read: https://help.github.com/articles/fork-a-repo/)

Go to your development machine and make sure the git module is loaded:
module load git

Copy to your development machine using (the full address is on the far right, halfway down on your new forked repo where it says "Clone this wiki locally"):
git clone https://github.com/USER_NAME/FORKED_REPOSITORY_NAME

Set the original code as 'upstream', so you can keep track of changes:
git remote add upstream https://github.com/UMD-AOSC/Ocean-LETKF.git

Check to make sure that was added correctly:
git remote -v

Create a new branch for editing:
git checkout -b BRANCH_NAME

Make sure you're switched to the new branch:
git checkout BRANCH_NAME

After editing, add all the new changes to the index:
git add .
-or-
git add --all .

Commit the new changes to the record:
git commit -m "message about the changes you made"

Sync your local changes with the GitHub repository:
git push origin BRANCH_NAME

Here's a nice git tutorial to get started with git if you haven't used it before:
https://www.atlassian.com/git/tutorials/what-is-version-control/

Also see:
http://rogerdudler.github.io/git-guide/files/git_cheat_sheet.pdf

To keep your local branch (let's call it "myDev") in sync with the master:
git checkout master
git pull
git checkout myDev
git merge master

Then when you're ready to put myDev changes into master, first merge in master like above, then ...
git checkout master
git merge myDev
git push origin master

The assumption here is that myDev is a branch with work that isn't ready to go into the master branch yet. So only merge into master when myDev is thoroughly tested.