Skip to main content

Command Palette

Search for a command to run...

Code Repositories

Updated
7 min read
Code Repositories
Y

I am an DevOps Consultant learning new tools and technology.

Repositories means a place or containers where something is deposited or stored.

As a software developer, your first baby step is to create some place or folder to store the code or solution you own. Locally you get some software like Eclipse, git, vs studio however when it comes to bigger organisations you need to get it integrated with tools. This enables developers to manage changes to their code and track who made each change.

We will understand the various repository types:

GIT

Git is a version-control system for tracking changes in computer files and coordinating work on those files among multiple developers.

Git is a Distributed Version Control System. So Git does not necessarily rely on a central server to store all the versions of a project’s files. Instead, every user “clones” a copy of a repository (a collection of files) and has the full history of the project on their hard drive. This clone has all of the metadata of the original while the original itself is stored on a self-hosted server or a third-party hosting service like GitHub.

Git helps you keep track of the changes you make to your code. It is the history tab for your code editor. If at any point while coding you hit a fatal error and don’t know what’s causing it you can always revert to the stable state. So it is very helpful for debugging. Or you can simply see what changes you made to your code over time.

Git also helps you synchronise code between multiple people. So imagine you and your friend are collaborating on a project. You both are working on the same project files. Now Git takes those changes you and your friend made independently and merges them into a single “Master” repository. So by using Git you can ensure you both are working on the most recent version of the repository.

Branch names are mostly used along with their purpose.

  • Master: The master branch is the main branch of the project. It contains production-ready code.

  • Develop: The development branch is the main development branch. It contains all of the changes that are currently being worked on. (eg. developerName_Dev_date ).

  • Feature: Feature branches are used to develop new features. When a feature is complete, it is merged into the development branch. (eg. developerName_Feature_date ).

  • Release: Release branches are used to prepare for a release. When a release is ready, it is merged into the master branch. (eg. Release_versionName_date ).

  • Hotfix: Hotfix branches are used to fix critical bugs. When a hotfix is ready, it is merged into the master and develop branches. (eg. developerName_Hotfix_date ).

BitBucket

Bitbucket is a Git-based source code repository hosting service. It gives you a central place to manage git repositories (repos), collaborate on your source code, and guide you through the development flow. Bitbucket Cloud is hosted on Atlassian’s servers and accessed via a URL. Bitbucket Cloud has a built-in continuous integration tool, pipelines, that enables you to build, test and deploy from directly within Bitbucket.

Azure Repos

Azure DevOps has a lot of offerings for different phases of a project management and delivery. Azure pipelines help in automating the software build and release process and setup a continuous integration and delivery (CI/CD) process. It help you to integrate your inbuild repos or from GIT or Bitbucket.

AWS Code Repository

AWS CodeCommit is a source control storage and version code service provided by Amazon. It helps the team with better code management and collaboration, exploiting the benefits of CI/CD. It eliminates the need for a third party version control. This service can be used to store assets such as documents, source code, and binary files. It also helps you manage these assets. Managing includes scaling, integrating, merging, pushing and pulling code changes. Let’s have a better look at services provided by CodeCommit:

Fully Managed Service:

If you’re a DevOps engineer, wouldn’t you like to keep your entire focus on production instead of maintaining updates, and managing your hardware or software? AWS CodeCommit eliminates the boring tasks of managing your resources providing high service availability and durability.

Store Code Securely:

Since it's a version control system, it stores your code. It stores any kind of data, be it documents or binary files. Data stored is pretty secure as they’re encrypted at rest as well as in transit.

Work Collaboratively With Code:

AWS CodeCommit lets you collaboratively work with the code. You can work on a section of the code and the other person/team can work on the other section, the changes/updates can be pushed and merged in the repository. Users can review, and comment on each other’s code helping them write code to their highest potential.

Highly Scalable:

AWS CodeCommit lets you scale up or down to meet your needs. The service can handle large repositories, a large number of files with large branches and lengthy commit histories.

Integration:

You can easily integrate AWS CodeCommit with other AWS services. It keeps these services close to other resources making it easier and faster to fetch and use increasing the speed and frequency of the development life cycle. It also lets you integrate third-party services pretty easily.

Migration:

You can easily Migrate any Git-based repository to CodeCommit easily.

Interactions Using Git:

Interacting with CodeCommit is pretty simple as it's Git-based. You can use Git Commands to pull, push, merge or perform other actions. It also gives you the feature to use AWS CLI commands along with its very own APIs.

Cross-Account Access:

CodeCommit lets you cross-link two different AWS accounts making it easier to share repositories between two accounts securely. There are a few things to keep in mind like you shouldn’t share your ssh keys or AWS credentials.

GITLAB

GitLab is a powerful version control platform that allows developers and teams to work on projects collaboratively. It provides version control, issue tracking, code review, and continuous integration and delivery (CI/CD) tools in one package. It also provides a secure environment for developers to store and share code and manage projects.

GitLab allows you to set up CI/CD pipelines for your repositories. This is done by adding a ‘.gitlab-ci.yml’ file to your repository. This file describes the steps that will be taken for each job in the pipeline, such as building, testing, and deploying the code.

Once the pipeline is configured, you can set up triggers to run the pipeline automatically when certain conditions are met, such as when changes are pushed to the repository or when a branch is merged. This allows you to automate the process of building, testing, and deploying code, ensuring that your code is always up-to-date and running smoothly.

MONOREPO

Google, Meta, Uber, and Airbnb put almost all of their code in one repository. This practice is called a mono repo.

Monorepo isn't new; Linux and Windows were both created using Monorepo. To improve scalability and build speed, Google developed its internal dedicated toolchain to scale it faster and strict coding quality standards to keep it consistent.

Within Monorepo, each service is a folder, and every folder has a BUILD config and OWNERS permission control. Every service member is responsible for their folder.

In Monorepo, dependencies are shared across the entire codebase regardless of your business, so when there's a version upgrade, every codebase upgrades its version.

Monorepo has a standard for check-ins. Google's code review process is famously known for setting a high bar, ensuring a coherent quality standard for Monorepo, regardless of the business.

Google engineers built Bazel, and Meta built Buck. There are other open-source tools available, including Nix, Lerna, and others.

MICRO REPO

On the other hand, in Microrepo, each service is responsible for its repository, with the build config and permissions typically set for the entire repository.

Amazon and Netflix are major ambassadors of the Microservice philosophy. This approach naturally separates the service code into separate repositories. It scales faster but can lead to governance pain points later on.

In Microrepo, dependencies are controlled within each repository. Businesses choose when to upgrade their versions based on their schedules.

Microrepo can either set its standard or adopt a shared standard by incorporating best practices. It can scale faster for business, but the code quality might be a bit different.

Microrepo has had more supported tools, including Maven and Gradle for Java, NPM for NodeJS, and CMake for C/C++, among others.