Git Branching – Fast Forward

Think of it this way, you started watching a movie on your TV at home. You got 30 minutes into it and had to leave. While you were gone, you were able to use your phone to watch another 15 minutes from where you left off. so now you are at minute 45 in the movie.

Seems normal, right? When you got home, your TV will fast forward to minute 45 so you can resume watching as if you had been watching on the TV the whole time.

Now apply this flow to git branches. For example you create a branch to start work on one ticket (or solution). You finished the work on that ticket and now you want to merge it back to master.

In this scenario, if no additional work has occurred on master then git can perform a Fast-Forward merge. This is where the reference for master is simply moved forward to last commit on the branch you are merging.

Fast-forward merges in git are the same way because there was no conflicting activity on master after the branch was created.

In my previous post on basic git branching git actually performed fast-forward merge we just didn’t knew that it happened. Find below the screen shot of corresponding merge activity and for reference you read that post at https://hexquote.com/basic-git-branching/

  • First switch to the target (Master) branch >> git checkout master
  • Next, merge the source branch to master using >> git merge feature1

So, this was a simple explanation of fast-forward merge in Git. Till next post, Happy Coding.


Discover more from Hex Quote

Subscribe to get the latest posts sent to your email.

Discover more from Hex Quote

Subscribe now to keep reading and get access to the full archive.

Continue reading