Skip to content

GIT workflow

Vasily Nemkov edited this page Nov 21, 2018 · 17 revisions

Overview

For early versions, we use regular simplified github-flow, that is each developer has to:

Initial set up

To start working on a project, fork corresponding Multy-io project using GitHub UI. Then, clone forked project into your machine with:

git clone <url>

For example:

git clone [email protected]:Multy-io/Multy-Core.git

Then add a upstream remote:

git remote add upstream [email protected]:Multy-io/Multy-Core.git

Remotes

We are using following remotes:

origin # your personal fork of the corresponding Multy-io project
upstream # Multy-io project
<other> # you might add a remote to share your pull work from others.

To list all remotes, do:

git remote -v

You should see something like:

origin	[email protected]:Enmk/Multy-Core.git (fetch)
origin	[email protected]:Enmk/Multy-Core.git (push)
pasha	https://github.com/PashaKlybik/Multy-Core.git (fetch)
pasha	https://github.com/PashaKlybik/Multy-Core.git (push)
upstream	[email protected]:Multy-io/Multy-Core.git (fetch)
upstream	[email protected]:Multy-io/Multy-Core.git (push)

Adding a remote

git remote add <name> <URL>

For example, to add upstream:

git remote add upstream [email protected]:Appscrunch/Multy-Core.git

Add a feature or a fix

  1. create a feature-branch from upstream/master (or other branch), see more in branches:
    • branch name should start with Jira issue key and short description:
      MUL-643_BTC_explicit_change_address
  2. implement a feature or fix a bug
  3. commit, with following message format:
  4. squash all commits of feature-branch into one
  5. push feature branch to the origin.
  6. Create a pull request to an appropriate branch of the upstream using github UI.
  7. When a feature or fix is ready to commit (all modifications were reviewed and accepted by reviewers), it should be merged into upstream with big green "Merge pull request" button. Please do not use "Squash merge" as it breaks history on GitHub.

Please note that PR must contain information on what was done and why, basically, if you have solid commit messages, you can use squashed comment description as PR text.

Branches

New Feature

To develop a new feature create a new branch from most recent upstream/master:

git fetch upstream/master
git checkout -b MUL-643_BTC_explicit_change_addres FETCH_HEAD

Switch to another task

First, save current progress by committing and pushing into github.

git add files-that-are-not-managed-by-git-yet
git commit -a
git push origin HEAD

Now switch to another task: To start a new task, please follow instructions in 'New feature'. Or switch to existing task:

git checkout branch-name

Update current branch to be up to date with master

If there is a new fix\feature in upstream/master you want to use in your branch, rebase it:

# Don't forget to add new files.
git commit -a
git fetch upstream\master
git rebase -i FETCH_HEAD

Submitting your work for a review

First, make sure that all the files you want in a review are added and committed. Then, submit your work to a GitHub, with:

git push origin HAED

Go to GitHub UI and create a pull request.

Modifying PR

# Edit files according to a review
git commit -a
git push origin HEAD -f # updates a PR automagically.

Release

Once all features are done and merged, it is time to release a new version based on your work.

  • create a branch from a master, called release_X.Y
git branch -b release_1.5
  • push that branch to the upstream
git push upstream release_1.5
  • make a tag with the exact version
git fetch upstream
git checkout upstream/release_1.5 
git tag release_1.5.0 release_1.5 -m "<Tag message>"
git push upstream release_1.5.0
  • Build and ship the release from exactly release_1.5.0

Release hotfixes

Once the version is released, only hotfixes can be pushed to the corresponding branch. When you need to release a hotfix:

  • create a fix branch from release branch
git branch -b fix_MUL_1337_corrupting_blockchain_state_on_all_nodes_around_globe release_1.5
  • Fix an issue in that branch, commit fixes
  • make a PR and merge it into upstream/release_1.5 (with proper review)
  • tag new release
git fetch upstream
git checkout upstream/release_1.5 
git tag release_1.5.1 release_1.5 -m "Fixed corrupting blockchain state on all nodes around the globe"
git push upstream release_1.5.1
  • Build and ship the release from exactly release_1.5.1
Clone this wiki locally