-
Notifications
You must be signed in to change notification settings - Fork 693
Workflow for WRF Code Modification
Depending on the type of modification you are making, your workflow can vary. Following these instructions will help to guide you through the process without errors. There are 2 types of workflows: 1) bug-fix, 2)development. If you are doing modifications for a bug-fix, you will want to do this from the the upcoming release branch, which uses the naming convention release-vX.0.X (e.g., release-v4.0.1). If you are doing developmental work, or anything that is not a bug fix, you will do this from the 'develop' branch. Both types are described below (scroll down further for instructions for developmental modifications).
In order to be able to make changes on your local machine, you will need to first go to the wrf-model/WRF GitHub home page and create your own fork from the wrf-model fork. At the top right-hand corner of the page, click 'Fork' and then fork it to your own account. Once that is done, you are ready to start making modifications.
- Obtain your fork from the GitHub web interface and put it on your local machine:
git clone https://github.com/<your GitHub ID>/WRF WRF_LOCAL
*Note: WRF_LOCAL is a generic name. The git clone
command will simply copy your fork from the web interface to your machine and place it inside the directory name you give. You can name it something other than WRF_LOCAL if you'd like.
-
Go into your local directory:
cd WRF_LOCAL
-
Set your 'upstream' to the wrf-model fork, which is later used to ensure that your code is up-to-date:
git remote add upstream https://github.com/wrf-model/WRF
-
Check that your 'origin' points to your fork (/WRF) and that 'upstream' points to the wrf-model fork
git remote -v
-
If you have never made changes in your local copy of your fork, by default you are on the master branch. If interested, you can verify this:
git branch
This will list your working branches, with a " * " beside the branch you are currently on. -
Any bug fix modifications must be made from the 'release-vX.0.X' branch. You will need to determine the current bug fix branch name. For example, if the most recent official WRF release was V4.0.1, then the bug-fix branch you will need will be called "release-v4.0.2". Use the following command to ensure that you have that branch, and that it's up-to-date:
git pull upstream <most_recent_release_bug_fix_branch>
You should now be able to see the release branch if you issue git branch -a
-
Checkout the new release branch:
git checkout <most_recent_release_bug_fix_branch>
-
From the current branch (<most_recent_release_bug_fix_branch>), you can now create your new branch name, to which you will begin making modifications:
git checkout -b <my_bug_fix>
You will now be automatically on the new branch (<my_bug_fix>, or whatever you name it).
-
Make all changes to the code, do testing, etc.
-
Once you are happy with the modifications, stage the changes:
git status
(shows you all files that have been modified)
git add <modified file>
(do this for each file from the above list that you'd like to commit) -
Save the changes to the local repository:
git commit
A text window will pop up - enter a short 1-line description of the modifications and then save the file. -
Push those changes up to your fork on the GitHub web interface:
git push origin <my_bug_fix>
-
Go to the wrf-model/WRF GitHub home page and create a new pull request. A commit message template will automatically be in the pull request text box. Fill it out appropriately. At the top of the pull request edit page, you will see something like: wants to merge 1 commit into base:master from Using the drop-down box, you will need to modify the 'base' in that sentence to the newest release branch (e.g., base:release-v4.0.1)
- Obtain your fork from the GitHub web interface and put it on your local machine:
git clone https://github.com/<your GitHub ID>/WRF WRF_LOCAL
*Note: WRF_LOCAL is a generic name. The git clone
command will simply copy your fork from the web interface to your machine and place it inside the directory name you give. You can name it something other than WRF_LOCAL if you'd like.
-
Go into your local directory:
cd WRF_LOCAL
-
Set your 'upstream' to the wrf-model fork, which is later used to ensure that your code is up-to-date:
git remote add upstream https://github.com/wrf-model/WRF
-
Check that your 'origin' points to your fork (/WRF) and that 'upstream' points to the wrf-model fork
git remote -v
-
If you have never made changes in your local copy of your fork, by default you are on the master branch. If interested, you can verify this:
git branch
This will list your branches, with a "*" beside the branch you are currently on. -
Any developmental modifications must be made from the 'develop' branch. Use the following command to ensure that you have that branch, and that it's up-to-date:
git pull upstream develop
You should now be able to see the develop branch if you issue git branch -a
-
Checkout the develop branch:
git checkout develop
-
From the current branch (develop), you can now create your new branch name, to which you will begin making modifications:
git checkout -b <my_mods>
You will now be automatically on the new branch (<my_mods>, or whatever you name it).
-
Make all changes to the code, do testing, etc.
-
Once you are happy with the modifications, stage the changes:
git status
(shows you all files that have been modified)
git add <modified file>
(you will do this for each file from the above list that you'd like to commit) -
Save the changes to the local repository:
git commit
A text window will pop up - enter a short 1-line description of the modifications and then save the file. -
Push those changes up to your fork on the GitHub web interface:
git push origin <my_mods>
-
Go to the wrf-model/WRF GitHub home page and create a new pull request. A commit message template will automatically be in the pull request text box. Fill it out appropriately. At the top of the pull request edit page, you will see something like: wants to merge 1 commit into base:master from Using the drop-down box, you will need to modify the 'base' in that sentence to the develop branch (e.g., base:develop)