Skycoin repos use two branches:
- master
- develop
Note: while in early development, or for minor applications/libraries, a repo might only use a master branch
The develop
branch is set to the default branch. All pull requests will have a default target of develop
, and a freshly cloned repo will clone the develop
branch.
When the software is ready for a versioned release, the develop
branch is merged to the master
branch and a new release is created from the "releases" page. This create a git tag with a version number. All versions should follow semantic versioning, the essential part being that all version tags follow the format vMAJOR.MINOR.PATCH
.
Therefore, to checkout the latest stable version of the source, one must git checkout master
.
To setup your local copy of the repo for development:
- Fork the repo within github
- in github.com, click on "fork" in top right. Select your github account as the destination.
- Clone the original repo to your local machine
git clone [email protected]/skycoin/REPO-NAME
- Add your fork as a remote
cd REPO-NAME
git remote add YOUR-USERNAME [email protected]/YOUR-USERNAME/REPO-NAME.git
git remote -v
(this should show the following:)
origin [email protected]:skycoin/REPO-NAME.git (fetch)
origin [email protected]:skycoin/REPO-NAME.git (push)
YOUR-USERNAME [email protected]:YOUR-USERNAME/REPO-NAME.git (fetch)
YOUR-USERNAME [email protected]:YOUR-USERNAME/REPO-NAME.git (push)
To make and submit changes to the repo:
- Checkout a new branch
git checkout -b my_branch
- Stage changed files for a commit:
git add .
(you can specify individual files, or use.
for all files under the current directory)
- Commit changes
- `git commit -m "A good commit message" (Note: you can include the issue number in the message and Github will link it, e.g. "fixed #39" in the commit message will cause issue #39 to close automatically when the pull request is merged)
- Push this branch to your upstream fork
git push YOUR-USERNAME my_branch
- Go to the github.com/skycoin/REPO-NAME page and create a pull request from
YOUR-USERNAME/my_branch
toskycoin/develop
- After tests pass and the PR is approved, it can be merged.
- After the PR is merged, update your local repo copy
git checkout develop
git pull
git branch -d my_branch
(optional: delete your merged branch)
- If there are merge conflicts in the PR, they can be fixed this way:
git checkout develop
git pull
git checkout my_branch
git merge develop
git diff
- Observe files which have merge conflicts and fix the merge conflicts. There are GUI tools that can assist, or the files can be merged by hand in a text editor.
git add .
git push YOUR-USERNAME my_branch
- If you need to make more changes to your branch, commit the changes and push again. The PR will automatically update
git checkout my_branch
git add .
git commit -m "A good commit message"
git push YOUR-USERNAME my_branch