Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
noresm:gitbestpractice [2015-11-13 14:21:31] alfg |
noresm:gitbestpractice [2022-05-31 09:29:32] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====Obtain a copy of the model (using git)==== | ====Obtain a copy of the model (using git)==== | ||
- | First: Visit this page: https:// | + | |
+ | - **Create a github user:** You can create the github user yourself. Go to https:// | ||
+ | - Visit this page: https:// | ||
+ | - Send email to oyvind.seland@met.no to get the right permissions for the new github user (The email must contain who you are and the github username). | ||
+ | - When you have the right permissions, | ||
+ | - git clone https:// | ||
- | Then use the command < | + | The last point will create a new directory called "noresm" in the place you checked out the model. Go to that directory before executing any git-commands. |
- | To make life easier and avoid typing passwords all the time, follow | + | If you get error messages, verify that you can open the page https:// |
+ | |||
+ | **Also do the following on all machines where you use git:** | ||
+ | * **Make sure you have a version of git >= 2.0** (add the line " | ||
+ | * **git config - -global push.default simple** (Will edit your ~/.gitconfig file to a safer way to share your modifications, | ||
+ | |||
+ | Note that with git, the main branch is no longer called " | ||
====Verify that you have the correct checkout ==== | ====Verify that you have the correct checkout ==== | ||
+ | |||
+ | When you have cloned the model, check that you have gotten what you wanted! | ||
Check that your favourite branch is available using the command | Check that your favourite branch is available using the command | ||
< | < | ||
+ | (You should see the branch " | ||
To check out (locally) your favourite branch and to start working on it, write | To check out (locally) your favourite branch and to start working on it, write | ||
Line 16: | Line 30: | ||
If you don't user the " | If you don't user the " | ||
- | < | + | < |
+ | < | ||
Note that once a branch has been checked out using the -b option, you can switch between any of your checked out branches using the command | Note that once a branch has been checked out using the -b option, you can switch between any of your checked out branches using the command | ||
< | < | ||
+ | |||
+ | Note that in git, switching to a new branch change the files in your working directory. Git will warn you if you have any modified files before switching to a new branch. This is different from how svn works. | ||
====Modify files ==== | ====Modify files ==== | ||
Modify the code (for example a file named myChangedFile.F90) and send back to your local repository through | Modify the code (for example a file named myChangedFile.F90) and send back to your local repository through | ||
- | < | + | < |
< | < | ||
+ | |||
+ | The message should link to the issue on github, so if you fix issue number 100 by this code change, you would probably write something like < | ||
Verify, using the tool " | Verify, using the tool " | ||
+ | |||
+ | ====Get modifications from github ====== | ||
+ | |||
+ | < | ||
+ | |||
+ | To be absolutely sure about branch names etc, you can do | ||
+ | |||
+ | < | ||
====Send modifications to github ====== | ====Send modifications to github ====== | ||
Line 35: | Line 62: | ||
You can also do (to be completely sure): | You can also do (to be completely sure): | ||
- | < | + | < |
====If you don't understand and want to get back to svn ==== | ====If you don't understand and want to get back to svn ==== |