Essential Git for Scientists
  • Introduction
  • Basic Concepts
    • Version Control
    • Git
    • Repo
    • Commits
    • Branches
    • Remotes
    • GitHub
    • De-centralisation
    • Summary
  • Basic Operations
    • Install Git
    • Create a Repo
    • Make a Commit
    • Inspect a Previous Commit
    • Revert a Change
    • Make a Branch
    • Extend a Branch
    • Fast-forward merge
    • Resolve conflicts
  • Intermediate Concepts
    • Commits
    • Three Trees
    • Rebase
    • Fetch
    • Pull
    • Push
  • Advanced Concepts
    • Reset
    • Interactive rebase
    • Formatted patches
    • Blame
    • Stash
    • Log filter
  • Cookbook
    • Undo
    • Branches
    • Diff
    • Stash
    • Merge
    • Hooks
    • Squashing
    • Rebase
    • Interactive Rebase
    • LFS
    • Submodules
    • Remote
    • Force push
    • Identify merged branches
    • Formated patches
    • Apply patches
    • Interactive rebase
    • Squash commits
    • Pull rebase
    • Log
    • Blame
    • Biset
    • Reset
  • Exercise
    • Exercise 1
    • Exercise 2
Powered by GitBook
On this page
  • Rationale
  • Command
  • Notes
  1. Cookbook

Identify merged branches

Rationale

  • You might want to delete a branch (e.g. a feature branch).

  • Before you do that, you might want to check whether that branch is fully merged.

  • In others, you should know which branches are fully included in the current branch.

Command

  • git branch --merged show the branches merged with the current branch.

  • git branch --no-merged similar, but show the NOT merged

  • Both can be used with the -r to include the remote tracking branch.

Notes

  • From officials, merged branches means

    Branches whose tips are reachable from the specified commit (HEAD if not specified).

  • If you traverse backwards from the commit specified (default: HEAD), do you see the tip (end) of those commits?

    • If so, then it's merged.

  • You can provide the commit to travers from.

    • git branch --merged <name>

    • git branch --merged origin/<name>

PreviousForce pushNextFormated patches

Last updated 1 year ago