What is a 'Fast-Forward' merge and when is it not possible?
Last updated
A fast-forward merge is when Git advances the current branch pointer directly to the tip of the branch being merged, because no divergent commits exist. It just moves the ref forward with no new merge commit, keeping history linear.
The condition: The current branch's tip must be a direct ancestor of the target commit: the feature branch is simply ahead.
What happens: No merge commit is created; the branch label slides forward to the newer commit.
When it's not possible: If the base branch also received commits since the branch diverged, histories have branched and Git must create a merge commit instead.
Enforcing behavior: Use
git merge --ff-onlyto abort rather than create a merge commit when a fast-forward isn't available.
- https://www.geeksforgeeks.org/html/full-stack-developer-interview-questions-and-answers/
- https://www.scribd.com/document/942005556/Git-Interview-Questions
- https://intellipaat.com/blog/interview-question/git-interview-questions-answers/
- https://www.reddit.com/r/cscareerquestions/comments/bxxwfc/what_are_some_behavioral_questions_you_have_been/
- https://www.reddit.com/r/rails/comments/1shfrbq/3_years_rails_dev_but_failed_basic_interview/
- https://www.reddit.com/r/cscareerquestions/comments/u7z2xh/how_often_do_developers_look_at_git_trees/