VDone Demo VDone Demo
Home
  • Articles

    • JavaScript
  • Study Notes

    • JavaScript Tutorial
    • Professional JavaScript
    • ES6 Tutorial
    • Vue
    • React
    • TypeScript: Build Axios from Scratch
    • Git
    • TypeScript
    • JS Design Patterns
  • HTML
  • CSS
  • Technical Docs
  • GitHub Tips
  • Node.js
  • Blog Setup
  • Learning
  • Interviews
  • Miscellaneous
  • Practical Tips
  • Friends
About
Bookmarks
  • Categories
  • Tags
  • Archives
GitHub (opens new window)

Nikolay Tuzov

Backend Developer
Home
  • Articles

    • JavaScript
  • Study Notes

    • JavaScript Tutorial
    • Professional JavaScript
    • ES6 Tutorial
    • Vue
    • React
    • TypeScript: Build Axios from Scratch
    • Git
    • TypeScript
    • JS Design Patterns
  • HTML
  • CSS
  • Technical Docs
  • GitHub Tips
  • Node.js
  • Blog Setup
  • Learning
  • Interviews
  • Miscellaneous
  • Practical Tips
  • Friends
About
Bookmarks
  • Categories
  • Tags
  • Archives
GitHub (opens new window)
  • 手册

  • 文档笔记

    • Git Basics and Commands
    • Git Branches - Branch Internals
    • Git Branch Creation and Merging - Branch Operations
    • Git Branch Management - Viewing Branches
      • Git Branching Workflows
      • Git Branches - Remote Branches
      • Git Branches - Rebasing
      • Git Tools - Revision Selection
      • Git Tools - Interactive Staging
      • Git Tools - Rewriting History
      • Git Tools - Reset Demystified
    • 《Git》学习笔记
    • 文档笔记
    xugaoyi
    2020-11-18
    Contents

    Git Branch Management - Viewing Branches

    # Git Branch Management - Viewing Branches

    # Viewing Branches

    $ git branch
      iss53
    * master  # The asterisk * indicates the current branch
      testing
    
    1
    2
    3
    4

    The git branch command does more than just create and delete branches. When run without arguments, it lists all current branches.

    # Viewing the Last Commit on Each Branch

    $ git branch -v
      iss53   93b412c fix javascript issue
    * master  7a98805 Merge branch 'iss53'
      testing 782fd34 test
    
    1
    2
    3
    4

    # Viewing Merged / Unmerged Branches

    The --merged and --no-merged options let you see which branches have or have not been merged into the current branch.

    $ git branch --merged # List merged branches
      iss53
    * master
    
    1
    2
    3

    Branches in this list without the * prefix can generally be deleted with git branch -d;

    $ git branch --no-merged # List unmerged branches
      testing
    
    1
    2

    The above shows the unmerged branch. Attempting to delete it with git branch -d will fail:

    $ git branch -d testing
    error: The branch 'testing' is not fully merged.
    If you are sure you want to delete it, run 'git branch -D testing'.
    
    1
    2
    3

    Force delete an unmerged branch:

    $ git branch -D testing
    
    1

    # Viewing Merged / Unmerged Branches for a Specific Branch

    The --merged and --no-merged options described above will, if no commit or branch name is given as an argument, list branches that have or have not been merged into the current branch.

    You can always provide an additional argument to check the merge status of other branches without checking them out. For example, which branches have not been merged into the testing branch?

    $ git branch --no-merged testing
      topicA
      featureB
    
    1
    2
    3
    Edit (opens new window)
    #Git
    Last Updated: 2026/03/21, 12:14:36
    Git Branch Creation and Merging - Branch Operations
    Git Branching Workflows

    ← Git Branch Creation and Merging - Branch Operations Git Branching Workflows→

    Recent Updates
    01
    How I Discovered Disposable Email — A True Story
    06-12
    02
    Animations in Grid Layout
    09-15
    03
    Renaming a Git Branch
    08-11
    More Articles >
    Theme by VDone | Copyright © 2026-2026 Nikolay Tuzov | MIT License | Telegram
    • Auto
    • Light Mode
    • Dark Mode
    • Reading Mode