How to get the status of whether Git can be fast forward merge by scripting

Gitlab has an option to select fast forward merge in its merge request. After that, merge request that does not meet this requirement cannot be merged. Now I want to check whether one branch can be fast forward merge to another branch, by script. How can I detect this state?

Git
Mar.04,2021

try it with dry run

Menu