Git and GitHub

Backend Engineering

Git and GitHub

Merging, Rebasing, Comparing and Reviewing Changes

Merging, Rebasing, Comparing and Reviewing Changes

Merging Branches

Merging is used to integrate changes from one branch into another. This is typically done to incorporate feature branches into the main branch.

Example:

# Merge a branch into the current branch
git merge feature-branch

Rebasing

Rebasing is another way to integrate changes, often used to keep a linear project history.

Example:

# Rebase the current branch onto master
git rebase master

Handling Merge Conflicts

When conflict changes occur, you must resolve them manually.

Example:

# Start a merge
git merge feature-branch

# Resolve conflicts in the affected files
# Mark the conflicts as resolved
git add resolved-file

# Complete the merge
git commit

Comparing and Reviewing Changes

Comparing Changes with Git Diff

The git diff command shows changes between commits, commit and working tree, etc.

Example:

# Show changes between working directory and staging area
git diff

Reviewing Commits with Git Log

The git log command displays the commit history.

Example:

# View the commit history
git log

Viewing File Changes with Git Show

The git show command shows various types of objects, including the file changes in a commit.

Example:

# Show changes in a specific commit
git show commit-hash

Whenever you're ready

There are 4 ways we can help you become a great backend engineer:

The MB Platform

Join 1000+ backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learnings and set schedules, and solve backend engineering tasks, exercises, and challenges.

The MB Academy

The “MB Academy” is a 6-month intensive Advanced Backend Engineering BootCamp to produce great backend engineers.

Join Backend Weekly

If you like post like this, you will absolutely enjoy our exclusive weekly newsletter, Sharing exclusive backend engineering resources to help you become a great Backend Engineer.

Get Backend Jobs

Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board