Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of accidental Fast Forward during the merging of git branches

Shulou Source: shulou.com Published: 2022-06-03 05:51:05 10月01日 Update

This article mainly explains "how to solve the problem of inadvertent Fast Forward in the merger of git branches". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem of inadvertent Fast Forward in the merger of git branches".

cause

Generally speaking, the development of a function will take advantage of the branch function of git, open a new function branch, and merge after the development is completed. At the same time, in order to easily view the corresponding history of the development of this feature in the future,-- no-ff will be used to prevent git from automatically performing the Fast Forward function and straighten the branch. But sometimes when merging, I will accidentally forget to add this-- no-ff, how to solve it?

Solve

Some people may think that using git reset-hard is fine, but if the branch has been developed for a long time, it may be more difficult for you to trace which branch opened after the submission. Actually, git has his own orders.

Once the git merge has been executed accidentally, just execute

Git reset-merge ORIG_HEAD

We can go back to the state before the merger, and then proceed.

Git merge-- no-ff-m "

Then we can merge No Fast Forward.

Thank you for your reading, the above is the content of "how to solve the problem of accidental Fast Forward when merging git branches". After the study of this article, I believe you have a deeper understanding of how to solve the problem of accidental Fast Forward when merging git branches, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Branches carelessness problems functions development learning content generally speaking history just at the same time commands that is ideas situations articles time more state knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Microsoft Docker NVidia MariaDB