How can we know if a branch is already merged into master in GIT?

We can use following commands for this purpose:

  • git branch –merged master : This prints the branches merged into master
  • git branch –merged lists : This prints the branches merged into HEAD (i.e. tip of current branch)
  • git branch –no-merged : This prints the branches that have not been merged

By default this applies only to local branches.

We can use -a flag to show both local and remote branches.

Or we can use -r flag to show only the remote branches.

Read the full book at www.amazon.com
Posted in GIT, GIT Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*