Skip to content

Git

We use git as our version control system to track the changes on our project files.

General rules

  • Never commit and push to master
  • Assure that your source branch is always up to date with the latest commits.
  • De-structure your changes to 1 commit per change. e.g. I added a feature, fixed a bug, refactored a component… then I would have at least 3 different commits.
  • Format before commit.
  • Lint before commit.
  • Build (config prod) before commit.
  • Make sure all your tests pass before commit.
  • Do not leave any console.log (unless intended) on a commit.
  • Do not leave commented code as a “I might need it later” piece of code.

Rebasing

After publishing or pushing to branch we can proceed with a Pull Request to the source branch. After the request is merged we have to make sure that all the branches that have also that one as source branch are rebased. To do that we need to to the following assuming the source branch is master:

Terminal window
# Switch to our master branch
git switch master
# Pull latest changes
git pull
# Switch to the branch to be rebased
git switch new-feature
# Rebase
git rebase master
# Solve any conflicts that could appear
# Push force to this published branch
git push origin new-feature -f