DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Do You Know How to Use Git Merge — Squash?

4 years ago levelup.gitconnected.com
Do You Know How to Use Git Merge — Squash?

Summary: This is a summary of an article originally published by the source. Read the full original article here →

While working on a feature branch many times you come across a situation where you have to deliver a single commit from the feature branch to the master branch. But you have multiple commits for a single bug/feature in your feature branch.

Let’s say you have two branches masterand featureand their git commit history looks as below: To squash all the commits of your feature branch and merge them in the master branch, you can perform the following steps: git checkout master Now perform squash, this will take all your commits from the feature branch and creates one single squash for all commits of the feature branch into the master branch.

After performing all the above operations your git commit history will look as below: The master branch commit history will look as below after performing git merge --squash: That’s all for this article.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com