Git conventions - sinsunsan/archiref_wiki GitHub Wiki

h1. GIT conventions

{{toc}}

h2. Branching convention

There are 2 main branches that are ALWAYS present and used: master (contains major project releases and releases after each sprint) and develop (development code). There are 3 supporting branches:

  • feature branches - is created per each feature (task in redmine).
  • release branches - is created after each sprint.
  • hotfix branches - hot fixes in the master branch.

h2. Naming conventions for supporting branches

h3. Feature branch

  • may branch only from develop
  • must be merged back into develop
  • must have next format "[issue_id]-[name of the task]". There can be exceptional cases when there is not issue for the branch, in this case branch name must not start with master, develop, release, hotfix and must have a good description explaining it's purpose.
  • all commits in this branch must have format "task #[issue_id]: description"

h3. Release branch

  • may branch only from develop
  • must be merged into develop and master
  • must have next format "release-[release number]"

h3. Hotfix branch

  • may branch only from master
  • must be merged into master and develop
  • must have next format "hotfix-[release number].[hotfix number]"
  • all commits in this branch must have format "task #[issue_id]: description"

h1. Workflow

h2. Get the code

h3. Clone the repository

git clone [email protected]:rue89v2 /path/to/repository/on/local/computer

h3. Check branches

git branch

h3. Get latest changes from branch

git co develop
git pull origin develop

h2. Feature branch

h3. Create a feature branch

git checkout -b 12345-test-issue develop

h3. Merging finished feature with develop

git checkout develop
git merge 12345-test-issue develop
git branch -d 12345-test-issue
git push origin develop

h2. Release branch

h3. Creating release branch

git checkout -b release-1.2 develop

h3. Finishing a release branch

git checkout master
git merge release-1.2
git tag -a 1.2
git push origin master
git checkout develop
git merge release-1.2
git push origin develop
git banch -d release-1.2

h2. Hotfix

h3. Creating a hotfix

git checkout -b hotfix-1.2.1 master

h3. Finishing a hotfix

git checkout master
git merge hotfix-1.2.1
git tag -a 1.2.1
git push origin master
git checkout develop
git merge hotfix-1.2.1
git banch -d hotfix-1.2.1
git push origin develop
⚠️ **GitHub.com Fallback** ⚠️