If you’re short on time: focus on the concepts and the Git quick-start later in this doc. These fundamentals are what enable building automated pipelines and repeatable releases.
Why source code management matters
Modern applications are often composed of multiple components maintained by different teams:
When many developers work on the same codebase — sometimes editing the same files — you need a system to coordinate changes, keep a history, and manage versions across development, staging, and production. That system is SCM (also called version control or revision control).
What an SCM system provides
An SCM system solves collaboration and auditability problems by:- Storing source code in centralized or distributed repositories (on-prem or cloud).
- Tracking changes over time with metadata (who changed what and when).
- Allowing multiple contributors to work concurrently and merging changes.
- Flagging merge conflicts when edits overlap and cannot be auto-merged.
- Providing history, review workflows, and analytics for releases.
Example repository layout
A typical web application repository might use a structure like this:How merging works (and resolving conflicts)
When multiple developers modify the same codebase, the SCM attempts to merge changes automatically by comparing edits line-by-line. If two changes touch the same lines in incompatible ways, the system flags a merge conflict and requires manual resolution. Here is a small example showing how a diff/patch might look when merging changes from two contributors:Always pull the latest changes from the mainline branch before starting significant work. Frequent merges reduce the risk and complexity of conflicts, and ensure your feature branch integrates smoothly.
Benefits of building on top of SCM
A well-structured repository and disciplined SCM practices enable:- Reproducible builds and automated tests (CI).
- Consistent pipelines for staging and production (CD).
- Controlled rollout strategies (feature flags, canary releases).
- Audit trails and compliance-ready change history.
- Better code reviews and improved software quality.
Quick Git demo (local setup using GitLab)
Below are concise steps to get a local Git workspace connected to a GitLab repository. We’ll use this repo later when configuring builds and pipelines.- Create a repository in GitLab (via the web UI).
- Clone the repository locally:
- Create and switch to a feature branch:
- Make changes, stage, and commit:
- Push the branch to GitLab:
- Open a Merge Request (MR) in GitLab to request review and merge into the main branch.
- After MR approval, merge and pull the latest main to your local workspace:
Links and references
- GitLab — hosting, merge requests, CI/CD
- GitHub — popular remote hosting and collaboration
- Bitbucket — repository hosting with pipeline support
- Git documentation — reference for Git commands and workflows