...
In order to achieve this, you should have got the upstream repo imported to Nordix Gerrit so you can do your work in a repo cloned from Nordix.
Uplift a Team Branch
Use this procedure to uplift (merge) the nordix-dev branch after your changes have been merged in to the ONAP repo and synched back to the nordix master branch.
- Fetch latest changes from central repo.
git fetch - Create a temporary branch based on the latest remote
git checkout -b nordix-dev_temp origin/nordix-dev - Perform the merge.
git merge origin/master - Depending on whether you encounter merge conflicts or not:
If there are conflicts you will have to solve them before continuing:
git status
git mergetool
git status
git commit
Remember to clean up the commit message (the default one provided by Git is not recommended)!
The git status command has no practical effect, but it's always good to run to keep track of what is happening. - If there are no merge conflicts Git will automatically commit the merge, but you should amend commit message (the default one provided by Git is not recommended):
git commit --amend
Running the git commit command also has the effect that a change-id is added to the commit message (if not present already). And you need a change-id to be able to push a commit for review. - Send uplift for review and to run verification
git push origin HEAD:refs/for/task/<owner>/<branch> - Go back to team branch.
git checkout task/<owner>/<branch>. - Remove temporary branch
git branch –d task/<owner>/<branch>_temp
The repos are automatically kept in synch.
When automatic rebase fails
When you run into the situation that you cannot commit in ONAP because a rebase is needed, but the "Rebase" button in Gerrit doesn't work, then rebase your change manually in your local repository.
Note: Cherry-picking a commit on top of a new base is the same as rebasing a commit on top of a new base. It's just a matter of which commit you have checked out before running the command. Cherry-picking is more flexible though and can be used for more than just rebasing.
- Fetch the latest changes for all branches from central Nordix repo to local repo.
git fetch - Make sure that latest commit on Nordix master is the same as the latest one on ONAP master. If not, send a mail to the "discuss" mailing list that there might be something wrong with the synch job.
- Create a temporary branch
git checkout -B temp_rebase_branch origin/master - Get the change from Gerrit by using the cherry-pick link on the Gerrit review page in Nordix.
git fetch https://gerrit.onap.org/r/dcaegen2/collectors/datafile refs/changes/69/67269/2 && git cherry-pick FETCH_HEAD - Resolve the rebase conflicts
git mergetool
git cherry-pick --continue - Resubmit to master in ONAPNordix
git push usptream HEAD:refs/for/master - Move to another branch so the temporary rebase branch can be deleted (git branch shows you the branches you have which you can move to)
git checkout <some other branch> - Remove the temporary local delivery branch
git branch –D temp_rebase_branch