Getting geeky with Git . Improving merge workflow with rebase

Getting geeky with Git . Improving merge workflow with rebase

Merging is not the only utility that can integrate changes from one branch onto another. In this article, we look into rebasing and learn how we can use it as an alternative to merging.

Merging is not the only utility that can integrate changes from one branch onto another. In this article, we look into rebasing and learn how we can use it as an alternative to merging.

The basics of rebasing

In the previous part of this series, we’ve learned that merging can result in an additional merge commit. This might not be the desired outcome if we aim for the readability of our git logs.

Rebase aims to rewrite git history so that it is simple and straightforward. To visualize it, let’s start with a clean repository:

 echo    "## rebase-repo"    >>    README . md

 git init

 git add  README . md

 git  commit    - m    "Initial commit"

 git remote add origin  git @ github . com : mwanago / rebase - repo . git

 git  push    - u    origin  master

If you want to know the importance of the  -u__ flag, check out the first part of this series._

Below, we simulate a very common situation. Imagine creating a new branch from master and starting to work on it. Before you finish up and want to merge it back to master, it contains some new changes.

 git branch  feature - two

 echo    "console.log('Feature one')"    >    feature - one . js

 git  add    . / feature - one . js

 git  commit    - m    "Added the first feature"

 git push origin  master

git

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Best Practices for Using Git

Git has become ubiquitous as the preferred version control system (VCS) used by developers. Using Git adds immense value especially for engineering teams where several developers work together since it becomes critical to have a system of integrating everyone's code reliably.

7 Best Practices in GIT for Your Code Quality

Git plays a significant role in software development. It allows developers to work on the same code base at the same time. Check out 7 best practices for Git.There is no doubt that Git plays a significant role in software development. It allows developers to work on the same code base at the same time. Still, developers struggle for code quality.

Git Rebase Tutorial and Comparison with Git Merge

In this article, I will explain to you a few differences between git merge, git rebase, and the git interactive rebase.I will tell a bit about what pros...

Mirroring Git Changes From One Server to Another Server

Hello all, nowadays most of the development teams using GIT version control, some of you may have a requirement of mirroring your team's git changes from one server to another Git server. This article will help you to achieve the Git mirroring between one server to another server.

Git Merge: A Git Workflow explained 

Since my articles on Git Rebase seem to be grabbing a lot of attention since the day 1, I thought of writing another article on Git Merge. If you don’t know how to rebase in Git, please check my last article on Git Rebase.