Skip to content
Aleksandar Šmigić edited this page Mar 24, 2022 · 1 revision

Branching strategy

  • We will be using the GitHub flow
  • The main idea is to have 2 types of branches
    • main branch
    • feature/fix branches

Main branch

  • This branch hosts only the code that is fully runnable
  • Whenever you want to share a new feature or a fix with your colleagues, it has to be merged into main by creating a PR from your feature/fix branch

Feature/fix branches

  • These are the branches where you will develop your features and fixes
  • You base them on main and create commits on them
    • Note that you are free to create as many local branches (that are based on your feature branch) as you want, just remember that you will be creating the PR from the feature branch
  • Only when you're fully finished with the feature do you create a PR
    • One exception to the rule is when you're stuck on a problem you don't know how to solve
      • Instead of merging into main (because we merge into main only complete features/fixes) for your colleagues to see your work, you can create a PR which will enable easier commenting and asynchronous communication

Pull Requests (PRs)

  • You can create PRs from the web interface or using the GitHub CLI tool
    • The CLI tool is the recommended way of doing that
    • Before using the gh tool you need to set it up with your credentials
  • TODO: write about CI/CD and merge options

Workflow example

  • Typical workflow example when you are creating a new feature/fix:
$ git checkout main
$ git pull  
$ git checkout -b branch_name
# now you do your development (git add, git commit...) 
# only when you're sure you've finished the feature/fix you create a PR
$ gh pr create
TODO: add the rest of the interface
# your code should be reviewed by a colleague before getting merged into main

Clone this wiki locally