noresm:gitbestpractice

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
noresm:gitbestpractice [2015-11-24 09:43:41]
alfg
noresm:gitbestpractice [2022-05-31 09:29:32] (current)
Line 4: Line 4:
   - **Create a github user:** You can create the github user yourself. Go to https://github.com/join and create a user (Make user-name which is easy to understand, for example FirstnameLastname. You can attach several email-addresses to the same user.)   - **Create a github user:** You can create the github user yourself. Go to https://github.com/join and create a user (Make user-name which is easy to understand, for example FirstnameLastname. You can attach several email-addresses to the same user.)
   - Visit this page: https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup   - Visit this page: https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
-  - Send email to alf.grini@met.no (with a copy to trond.iversen@met.no) to get the right permissions for the new github user (The email must contain who you are and the github username).+  - 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, you can obtain the code.   - When you have the right permissions, you can obtain the code.
   - git clone https://githubUserName@github.com/metno/noresm.git    - git clone https://githubUserName@github.com/metno/noresm.git 
- 
-**Also do the following:** 
-  * **Make sure you have a version of git >= 2.0** (add the line "module load git" to your .bashrc files) 
-  * **git config --global push.default simple** (Will edit your ~/.gitconfig file to a safer way to share your modifications) 
  
 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. 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.
  
-If you get error messages, verify that you can open the page https://github.com/metno/noresm in a web-browser. If you can not, you are probably not a github-user or not member of the noresm group on github.   +If you get error messages, verify that you can open the page https://github.com/metno/noresm in a web-browser. If you can not, you are probably not a github-user or not member of the noresm group on github.
  
-**More advanced:** To make life easier and avoid typing passwords all the time when contacting the remote (i.egithub), follow the recipe here:  https://help.github.com/articles/generating-ssh-keys/If you are still asked for passwords about your id_rsa.pub file, it is the password to log in to the machine where that file is stored which is needed (or the password you gave when you created the id_rsa.pub-file). Using this procedureyou can clone with <file> git clone git@github.com:metno/noresm.git </file>+**Also do the following on all machines where you use git:** 
 +  * **Make sure you have a version of git >= 2.0** (add the line "module load git" to your .bashrc files on hexagon, vilje) 
 +  * **git config - -global push.default simple** (Will edit your ~/.gitconfig file to a safer way to share your modificationssee http://stackoverflow.com/questions/13148066/warning-push-default-is-unset-its-implicit-value-is-changing-in-git-2-0)
  
 Note that with git, the main branch is no longer called "trunk", it is called "master"! Note that with git, the main branch is no longer called "trunk", it is called "master"!
Line 43: Line 41:
  
 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
-<file>git add myCHangedFile.F90 </file>+<file>git add myChangedFile.F90 </file>
 <file>git commit -m "aMessage" </file> <file>git commit -m "aMessage" </file>
  
-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 <file>git commit -am "Did part of the work to resolve #100" </file>+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 <file>git commit -am "Did part of the work to resolve metno/noresm#100" </file>
  
 Verify, using the tool "gitk" that the changes make sense. Verify, using the tool "gitk" that the changes make sense.
Line 64: Line 62:
  
 You can also do (to be completely sure): You can also do (to be completely sure):
-<file>git push remoteName myLocalBranchName:remoteBranchName </file> which if your are changing the master-branch would translate to <file>git push origin master:master </file> (The above command means push my changes to the remote named "origin" from my local branch named master to the remote branch named master. If you are changing another branch than master, you must obviously not write "master".+<file>git push remoteName myLocalBranchName:remoteBranchName </file> which if your are changing the master-branch would translate to <file>git push origin master:master </file> (The above command means push my changes to the remote named "origin" from my local branch named master to the remote branch named master. If you are changing another branch than master, you must obviously not write "master".)
  
 ====If you don't understand and want to get back to svn ==== ====If you don't understand and want to get back to svn ====
  • noresm/gitbestpractice.1448358221.txt.gz
  • Last modified: 2022-05-31 09:23:24
  • (external edit)