Skip to content

Development Process: Feature Branching

Paul Philion edited this page Mar 14, 2024 · 2 revisions

Based on https://docs.github.com/en/get-started/using-github/github-flow

The development process can be summed up as "feature branching":

  • each new feature to be implemented gets it's own git branch
  • all implementation work for that feature is done on that branch, by one or more people
  • once complete and tested, the feature branch is merged into main
  • which triggers the automated deployment

These commands can be issued using any tools, but CLI is provided here to demonstrate the details:

  1. Create a branch for work: git checkout -b name-of-new-branch
  2. Make the code changes with your preferred editor/IDE.
  3. Commit your changes: git commit -a -m "This is a message about the committed change."
  4. Push your commit to the shared repo: git push
  5. Once the work is complete, create a PR using the branch -> main (there's a button in github)
  6. If you're working as a group, everyone knows the code and you can skip a full code review.
  7. Otherwise, review the code with the team and address any issues (fix before merging, create a new issue, etc.)
  8. After review, merge the branch to main and delete the feature branch (the git branch which implemented the requested feature, not main).
  9. Deployment should be automatic after the merge to main, based on the git actions.

For completeness, a sequence diagram written in Mermaid:

sequenceDiagram
    actor User
    User->>git: Create new branch and check it out for work
    User->>IDE: Edit & test
    User->>IDE: Edit & test
    User->>IDE: Edit & test
    IDE->>User: Eureka! It works!
    User->>git: Commit these edits and push to origin repo
    User->>git: Create a PR for the changes!
    actor Reviewers
    Reviewers->>git: Review and approve PR
    git->>Reviewers: Approved
    User->>git: Merge branch to main
    User->>git: Delete feature branch
Loading