Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8435855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:01:56+00:00 2026-06-10T07:01:56+00:00

The way I like to see my git logs are with git log –graph

  • 0

The way I like to see my git logs are with

git log --graph --oneline --all --decorate

Among other things that I found useful its output, there are the branch names. However, if I delete a branch, then the above does not display them anymore. I mean seeing a bunch of stuff like:

* 87c3294 (QueueExample) blah blah

is much more expressive (especially when the list becomes long) than a bunch of

* 87c3294 blah blah

The answers to this question and in particular this comment seems to imply that the branch names are still “somewhere”.

How do I get them printed in the output of git log or at least in some other way?

Alternatively, how can I remove branches from the output of git branch, while still keeping them around for purpose of git log?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:01:57+00:00Added an answer on June 10, 2026 at 7:01 am

    In Git, branches are simply pointers to a commit that move as new commits are added on that branch. In other words, once the pointer has moved, there is no memory that previous commits were on that branch. This was a hard concept for me to wrap my head around at first. Perhaps it’s the name: "branch" makes me think of multiple nodes connected by edges, but in Git, a branch is really only a moving pointer to a node.

    git log dutifully annotates commits with any branch that is pointing to them. For example, I created a repo with commits "one", "two", and "three" on branch ‘main’ and "uno", "dos", and "tres" on branch ‘feature’, then merged feature back into ‘main’. Here’s what git log tells me before I delete the branch:

    *   9eb6e93 (HEAD, main) Merge branch 'feature'
    |\
    | * 523e2ac (feature) tres
    | * 6d3cc0f dos
    | * 1bc0b2e uno
    * | d39734b three
    * | 779d37b two
    * | facbcbf one
    |/
    * 58848f4 Initial commit.
    

    It’s easy to get fooled into thinking that the "(feature)" annotation is somehow referring to that branch on the right, but it’s not: it’s just referring to the commit 523e2ac.

    Note that, by default, when Git creates a merge commit (9eb6e93 in our case), it automatically adds a comment stating that it’s merging branch ‘feature’, so there is some record of there having been a branch there, but it’s just a comment, nothing more.

    When I delete the branch ‘feature’, nothing changes except that commit 523e2ac is no longer labeled with "(feature)":

    *   9eb6e93 (HEAD, main) Merge branch 'feature'
    |\
    | * 523e2ac tres
    | * 6d3cc0f dos
    | * 1bc0b2e uno
    * | d39734b three
    * | 779d37b two
    * | facbcbf one
    |/
    * 58848f4 Initial commit.
    

    So, to answer your question, no, once you’ve deleted a branch, you cannot get git log to annotate a commit with that branch name (because it doesn’t exist anymore). However, you have some alternatives:

    • Don’t delete the branch. There’s no harm in leaving branches around, except that it clutters up your screen when you type git branch. Also, you may want to re-use branch names, which could cause problems later on if you don’t delete your branches.

    • Tag the commit before you delete the branch. A tag is really a branch that doesn’t move. You can even make the tag name the same as the branch name.

    • Satisfy yourself with the automatic commenting of merge commits. As mentioned before, when Git does a merge, by default, it references the name of the branch being merged in in the commit comment, creating a record that the branch existed. To me, this is the cleanest solution, based on the way branches work in Git. Since a branch doesn’t really refer to a series of commits, it’s really only of historical consequence that a branch existed.

    The other place that branch history may linger is your reflog, which simply logs what branches you’re switching to/from. It’s mostly there for disaster recovery (ooops, I didn’t mean to delete that branch!), and it’s not really useful for the kind of branch history you’re talking about.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to see the best way to create a where statement with
I would like to see best way of posting to Facebook from a HTML
I would like to find a way to see what happens while my XAML
Is there any way to see what a control will look like in the
Is there any way to see how many queries are executed in like every
I would like to ask if there is a way to see a variable
Is there a way to see what's been saved to NSUserDefaults directly? I'd like
Is there any way to do things the short and easy way like below?
I am using Git cherry and would like to see more detail about the
I would like to add an update hook to git that prevents people from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.