git -no-ff rebase: Does It Exist?

Git No Ff Rebase

The git rebase command has no “fast-forward” or “no-fast-forward” option (git -no-ff rebase) like the git merge command, because it is not merging anything. A rebase is only integrating the (local feature) branch with another branch (e.g., master) at a certain position.

Rebasing the feature branch will still be its own “entity” in the git tree, but this branch could eventually be merged into the master branch when that is wanted.

Three Options for Integrating Git Branches

Lets recap the three main options of integrating git branches:

  1. git merge –no-ff : The “no-fast-forward” merge option preserves the branch history and creates a merge commit.
  2. git merge : The “fast-forward” (“–ff”) merge option is the default merge option (when possible). In the git log, the branch history for this merge will not be available anymore.
  3. git rebase : Rebasing lets you move a branch around by changing the commit the branch is based on. After rebasing, the branch will have a new parent commit, which is the same commit pointed to by master. Instead of joining the branches with a merge, rebasing integrates the feature branch by building on top of the master. In most cases, rebasing should only be done within your local git tree, so never rebase any pushed or pulled changes!

Here are the above three git operations shown visually:

git merge

Visualizing Git Merge

git rebase

Visualizing Git Rebase

Using git rebase –interactive

When we want to merge a rebased branch, it’s often a good practice to clean up the feature branch first in order to get a more concise git history. For this purpose, there is the git rebase –interactive command, which can:

  • Edit commit messages
  • Combine multiple commits into one commit
  • Delete or revert commits that are no longer necessary

I hope understanding these operations will help you get more out of git.

Advertiser Disclosure

HostingAdvice.com is a free online resource that offers valuable content and comparison services to users. To keep this resource 100% free, we receive compensation from many of the offers listed on the site. Along with key review factors, this compensation may impact how and where products appear across the site (including, for example, the order in which they appear). HostingAdvice.com does not include the entire universe of available offers. Editorial opinions expressed on the site are strictly our own and are not provided, endorsed, or approved by advertisers.

Our Editorial Review Policy

Our site is committed to publishing independent, accurate content guided by strict editorial guidelines. Before articles and reviews are published on our site, they undergo a thorough review process performed by a team of independent editors and subject-matter experts to ensure the content’s accuracy, timeliness, and impartiality. Our editorial team is separate and independent of our site’s advertisers, and the opinions they express on our site are their own. To read more about our team members and their editorial backgrounds, please visit our site’s About page.