Development process#
Branching model#
The following branches will always exist in pyHiM:
The
master
branch: reference branch of stable versions. We use the tag versioning systems.The
development
branch: features stable but pre-release features. Use at your own risk.Features branches are used for development of single features
Bug branches are use to fix specific bugs repported as
issues
. Once the bug is fixed, the branch is merged into thedevelopment
branch using a pull request and subsequentially deleted.
Template for branch naming scheme:
<context>/(<scope>/)short_definition_of_work
<context>
:fix
for bug fixfeature
for development about a new featuredoc
for adding documentationrefactor
for improvement of readability, reusability or structure
<scope>
is the feature ou field involved by this commit (optional)
Examples:
doc/contributor/write_dev_process
feature/matching/spot_into_mask
Typical workflow using git
#
Create a git branch#
Create your new branch:
git branch <new_branch>
Switch on the new branch:
git checkout <new_branch>
Create it in origin to notify other users that you have created this branch:
git push --set-upstream origin <new_branch>
You are ready to develop your new feature.
Merge with development branch#
The best way to validate your new features is to make a pull request. The code in the pull request will be reviewed by another member of the team before it can be merged into the Development branch.
On your GitHub repository, navigate to
pull requests
sectionButton
New pull request
Choose the both branch to compare
Before create this pull request, check your changes and check if your code is clean (without sauvage
print()
or commented code line)Create pull request
Validate this pull request with another member of the team
Squash your commits with pull request option
Delete your feature branch locally and remotely (see below)
Start a new task !
pyHiM releases#
New release versions are made using Semantic Versioning.
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards compatible manner, and
PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
show git activity history#
git log --graph --oneline
Delete your branch#
After you merge your pull request, please delete your branch. This will signal to other developers that the work on the branch is complete and prevents you or others from accidentally using old branches. For more information, see “Deleting and restoring branches in a pull request.”
When you delete a branch, the commit history will be transfered to the development branch. You can always restore your deleted branch or revert your pull request if needed.
// delete branch locally
git branch -d local_branch_name
// delete branch remotely
git push origin --delete remote_branch_name
Note
If you get the error below, it may mean that someone else has already deleted the branch.
error: unable to push to unqualified destination: remoteBranchName The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'git@repository_name'
Try to synchronize your branch list using:
git fetch -p
The -p
flag means prune
. After fetching, branches which no longer exist on the remote will be deleted.
Recover deleted branch#
Find the SHA
for the commit at the tip of your deleted branch using: Use git reflog
to do so:
git reflog
To restore the branch, use:
git checkout -b <branch> <sha>
Git squash#
If you want to squash working/insignificant commits from your <dev_branch>.
You can store your branch history in an over-branch for your first time:
git checkout dev_branch
git pull dev_branch
git branch save/dev_branch
Get an overview of your latest commits using
git log
or the GitHub interface.Identify the commit that you want to keep, and copy the hash of the previous (older) commit.
Make an interactive rebase:
git rebase -i <older-commit-hash>
It’s open a text editor (as image below), edit
pick
tosquash
for each commit that you want to squash within the top commit. Save, exit.An other text editor are open with the list of commit messages, edit them. Save, exit.
Check if it’s good with a new
git log
or with agit diff <commit1> <commit2>
.Apply changes on the remote repository:
git push -f
Delete your save branch:
git branch -D save/dev_branch