GitLab source control

We use GitLab for all our projects. The majority of our projects tend to have two to three people working on them at any given point and it's quite often that we'll come back to a project and maintain it for a signification period of time. It is therefore important that we keep repositories clean and tidy.

  1. Repository naming conventions
  2. Commit naming
  3. Commit frequency
  4. Version Control
  5. Branches

Repository naming conventions

Please use kebab-cased only, the repository name should be a naked version of the actual domain:

Commit naming

We don't have a particular format for a commit message however it would be encouraged that these are more descriptive. Once a project goes live the team should always provide descriptive commit messages:

It is very important that commits are more regular, this helps the team to review recent changes for whatever reason. Furthermore, at the end of the day a commit should be made for projects that are in-progress. Some example commits might be:

Commit frequency

It is encouraged to push more frequently i.e. when a task or sub-task has been completed. You may, however, choose to push many updates which are interlinked. It is up to you to decide on how often to push changes. If unclear, check with other members of the team!

Version Control

Understandably problems/issues can occur either locally or on GitLab. Fortunately a repository can be reverted, this means all local changes will be lost and reverted to x period ago. The command --hard is very destructive so make sure all changes are stored before putting this command to use. An example of this would be 1 day ago or 2 days ago or 2018-11-19 13:45:

Branches

GitLab sets master as the default branch for a project (repository). You can create and choose another branch push to, alternatively to manually creating a new branch on GitLab, you can do so using command line too. An example of this would be:

  1. $ git pull origin master # Pull latest changes before creating a new branch
  2. $ git branch -r # List all the current branches in the project
  3. $ git branch # List current branch
  4. $ git checkout -b <branch-name> # Create a new branch and check it out
  5. $ git branch # List new branch
  6. $ git add * # Add all local changes
  7. $ git commit -m "Testing branch" # Commit changes with title
  8. $ git push origin <branch-name> # Push changes to new branch