Skip to content

Engineering

Repository management (Git)

How do we manage our codes depends on several factors such as the type of project, the size and the phase.

Factor Example
Type Research / Application (with end-users)
Size Solo / 2-3 members / more
Phase Initial / Pre-release / Production
  • Generally, following Github Flow is requested for most of the project unless it's a solo project or in an initial phase.

  • For a project for application development for end-users, it's recommended to follow Gitlab Flow

    - In addition to main branch, add production for release

Commit and push frequently

There are several benefits to commit & push frequently;

  1. You can use Github as your backup
  2. You can roll back to previous code
  3. You can get feedbacks on time
  4. You can avoid duplicating work

Reference: Gitlab Flow

Commit often and push frequently

...

Committing often also helps you share your work, which is important so that everyone is aware of what you are working on. You should push your feature branch frequently, even when it is not yet ready for review. By sharing your work in a feature branch or a merge request, you prevent your team members from duplicating work. Sharing your work before it’s complete also allows for discussion and feedback about the changes. This feedback can help improve the code before it gets to review.

Reference: Git Commit Best Practices

Backup: In case you work on a task for several days without pushing to the central repository, you risk loosing your work in case your PC goes down (assuming you have no other backup system in place).

Safety net: Let’s say you copy + past to the wrong editor window. How to recover? Sure all editors have some “undo” function, but often times it only works until the last time you hit “Save”. Early and often git commits give you a comfortable safety net wich allows you to always go back to the latest commit version in case of an accident (or maybe your brilliant refactoring idea turns out to be not so brilliant).

Status: After pausing for some days/weeks, you will find it easier to remember what tasks have been done and what have not by looking at your git history.

The timing and frequency of commit & push;

  • When you have a progress, it's time to push
  • At least once per day if you work on something. It's OK to push several times per day.
  • You don't need to hesitate to push your work even if it's middle of something. You can use "[WIP]" identifier on commit log.