Git workflow¶
Proposing a pull request¶
Patches are welcome to our library repository: https://github.com/openturns/openturns.
Here are the steps required to propose a modification with git:
Setup git for first time use:
git config --global user.name "John Doe" git config --global user.email "johndoe@example.com" git config --global branch.autosetuprebase remote
Register on GitHub and add a new ssh key in https://github.com/settings/ssh:
ssh-keygen -t ed25519 -C "johndoe@example.com" cat ~/.ssh/id_ed25519.pub
Fork the library repository https://github.com/openturns/openturns and clone it via ssh:
git clone git@github.com:doe/openturns.git doe cd doe
Create a branch from master with a relevant topic name:
git checkout -b branch_name master
Commit your changes, split your work in as much commits as needed to ease reviewing:
git add <files> # Add current state of files to commit git commit ... git add <files> git commit
To write a nice commit message, keep a short commit title (less than 50 characters), leave a blank line, then add a more detailed description. If the commit fixes an issue, add Closes #NNN to the message body that way it will be closed automatically on merge. Also update the ChangeLog file accordingly.
Push the new branch to your personal repository:
git push --set-upstream origin branch_name
Create a pull request on https://github.com/openturns/openturns
That’s it, your code is ready for reviewing, but it may not be accepted as is.
Checkout the comments made after your pull request and the automated test result.
You may want to push more commits to that branch as required.
Propose a separate pull request for each topic you want to address.
Here are more resources on using pull requests and Git.
Keep your local repository in sync¶
You may want to keep your personal repository in sync with the main repository before starting new developments.
Add upstream remote repository:
git remote add upstream https://github.com/openturns/openturns.git
Retrieve usptream:
git fetch upstream
Merge upstream master branch to your local personal master branch:
git checkout master git merge upstream/master
You may also want to synchronize your current topic branch with the main repository:
Add upstream remote repository:
git remote add upstream https://github.com/openturns/openturns.git
Retrieve usptream:
git fetch upstream
Rebase your current branch to the main repository master branch:
git rebase upstream/master
Delete a branch¶
Once your pull-request is merged, you may want to delete the branch.
Delete local branch:
git branch -d branch_name
Delete remote branch:
git push origin :branch_name
Tagging a release¶
List existing tags:
git tag
Get the master branch:
git checkout master
Create the tag on local repository:
git tag -a v2.0 -m 'version 2.0'
Push the tag on the remote repository:
git push origin v2.0