Public:Working with code repo
From YaddaWiki
By default we work in so called 'shared repository model' where master branch is the branch we release from. Each developer has the right to push directly into the master branch (if the corresponding pull merge has been accepted). Every new feature is developed in some feature branch dedicated to this feature.
When you start developing a new functionality (or part of it), you create a new separate branch, you commit chunks of code, and then issue a pull request. After the pull request has been accepted by your colleague, you commit & push the changes as one commit to the master branch. This way the git log of the master branch will have linear history. The commit's name template for a master branch is as follows: CLOSES #ISSUE_NO: ISSUE_TITLE, where: - ISSUE_NO is the github's/gitlab's issue number - ISSUE_TITLE is the github's/gitlab's issue title
- Create a feature branch: git checkout -b feature_branch_name (feature_branch_name should start with your github login)
- Make your changes
- Commit your changes
- [Optionally, so the pull request will be more up-to-date] Clean up your history: git rebase master
- Run tests: gradlew clean test and gradlew clean slowTest
- Push the changes: git push origin feature_branch_name
- Issue a pull request on github (or merge request on GitLab) with master as the base branch and feature as the head branch
- Wait for changes to be accepted. If you are asked to revise your changes, edit your branch and push the changes.
- Clean up your history: git rebase master
- Merge the feature branch into master: git checkout master and then git merge feature_branch_name (or git merge --squash feature_branch_name if there are more than 1 commit in the feature branch)
- If merge was done with --squash option, then commit merged changes and modify commit message: git commit
- Pull the changes from origin: git pull --rebase origin (or git fetch origin and git rebase origin/master)
- Run tests before push: gradlew clean test and gradlew clean slowTest
- Push the changes to the master branch: git push origin master
- Delete the feature branch: git branch -D feature_branch_name and then git push origin :feature_branch_name
- [Optionally] Delete references to remote branches that do not exist in the repository anymore: git remote prune origin