Developing code for ICON
How to merge a branch back to icon-mpim:master documents how to merge your changes back to mpim master. However before embarking on this procedure please clarify with your supervisor if the proposed developments are desired.
Working on your own feature branch
1) In case you do not have the repository at all
git clone --recursive git@gitlab.dkrz.de:icon/icon-mpim.git
cd icon-mpim
You are now automatically on 'master', which is our main development branch and serves as reference.
Checkout a new ( feature-/bugfix- ) branch
git checkout -b feature-<my-branch>
In case the feature branch already exists you have to skip the -b! to simply change into the branch
Use the status command to check your status
git status
The result should look like
On branch feature-<my-branch> nothing to commit, working directory clean
2) Start doing your changes....
…use “git add/rm <file>…” to update what will be committed → your files will be staged
Check again with
git status
3) Commit your changes
git commit
The commit message has should be some useful information regarding your commit.
4) Publish your local branch:
git push origin feature-<my-branch>
5) Publish your local branch with a different name in our repository:
git push origin feature-<my-branch>:feature-<my-branch>-test001
So this is like pushing your actual branch to an intermediate copy of your actual branch.
This is necessary for further rebasing of your local feature branch with icon-mpim:master and has some more advantages: * you can check this version of your branch with buildbot independent of further changes in your local copy * you have a copy of this state of work * you can run test experiments with a fixed version of your development
6) Update your (local) branch with master regularly:
Be aware this might change your results if results of the main branch are changed. Discuss with your supervisor if this is useful and/or necessary for your further work!
First you have to add all changes done in the central icon-mpim.git repository to your local copy
git fetch --all
Then you have to rebase your changes to icon-mpim:master. This might lead to conflicts, as the work on icon-mpim:master is ongoing. It might also lead to differences in the output (see above)!
git rebase origin/master
Make changes and commit as in 3) and 4). “Publish” your local branch with a new different name in our central repository, for testing or storage, e.g.:
git push origin feature-<my-branch>:feature-<my-branch>-test002
—-
— Monika Esch 2024/08/21 15:07