Back to Resources

Version Control

Version control systems help teams manage changes to code over time. We use GitHub as our primary platform for version control and collaboration.

GitHub

GitHub is a web-based platform that provides hosting for software development and version control using Git.

G

GitHub

Key Features

  • Repository hosting and management
  • Issue tracking and project management
  • Pull requests for code review
  • Actions for CI/CD automation
  • Collaboration tools for teams

Git Basics

Understanding the fundamental Git commands is essential for effective version control.

Initializing a Repository

git init

Creates a new Git repository in the current directory.

Cloning a Repository

git clone https://github.com/username/repository.git

Creates a copy of a remote repository on your local machine.

Checking Status

git status

Shows the current state of your working directory and staging area.

Adding Changes

git add filenamegit add .

Adds file changes to the staging area.

Committing Changes

git commit -m “Commit message”

Records changes to the repository with a descriptive message.

Pushing Changes

git push origin branch-name

Uploads local repository content to a remote repository.

Branching Strategy

A good branching strategy helps teams collaborate effectively and maintain code quality.

Creating a Branch

git checkout -b feature/new-feature

Creates and switches to a new branch for developing a feature.

Switching Branches

git checkout branch-name

Switches to an existing branch.

Merging Branches

git checkout maingit merge feature/new-feature

Incorporates changes from one branch into another.

Pull Requests

Pull requests are a way to propose changes to a codebase and facilitate code review.

Creating a Pull Request

  1. Push your branch to GitHub
  2. Navigate to the repository on GitHub
  3. Click on “Pull requests” tab
  4. Click “New pull request”
  5. Select your branch as the compare branch
  6. Fill in the title and description
  7. Click “Create pull request”

Reviewing a Pull Request

  1. Open the pull request
  2. Review the changes in the “Files changed” tab
  3. Add comments on specific lines if needed
  4. Approve or request changes
  5. Merge the pull request when ready