Version control

Git and Gitflow

The vast majority of front-end projects use the Gitflow branching strategy. I highly recommend using the command line helper for this, if possible, to remove a lot of the repetitive merging tasks and potential for human error.

Gitflow, in short, is a scheme that determines where code is branched from, where it merges to, and identifies a specific naming strategy for the branches in between.

Older projects may have only used the main/master and develop branches. These can normally be migrated to using git flow without any architectural changes, with some exceptions.

Version controlling assets

Many of our projects have front-ends that work on the principle of having a source (src) directory and a distribution (dst or dist) directory.

The source directory contains the raw assets for the project, such as Sass code, TypeScript, unoptimised images, etc. It is the only one that is directly modified and should be stored in source control.

The distribution directory has everything that is needed for the website to function in a browser. Compiled CSS, JavaScript, optimised images and the like go in here. Destination directories should not be in source control, and their contents should be entirely generated by build tools on both developer machines and the build server.

Basically: Source is the only one that needs to be in source control, distribution is the only one that needs to be distributed anywhere, and never the twain shall meet.