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 7750833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:23:34+00:00 2026-06-01T11:23:34+00:00

I have two branches I normally work on: master and homepage_buildout. I was recently

  • 0

I have two branches I normally work on: master and homepage_buildout. I was recently told to checkout an old commit from before I was working on the project. I simply did:

 git checkout [commit number]

Then I decided to make this old commit a branch like so:

 git checkout -b old_homepage

Now, I realized that I don’t need to be able to reference the branch old_homepage anymore, but I still want it exist as a commit. How do I retain those commits but remove the branch from appearing when I type:

 git branch
  • 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-01T11:23:35+00:00Added an answer on June 1, 2026 at 11:23 am

    I think what you’re actually asking boils down to: “if I do git branch -d old_homepage will the commits get lost”, and the answer is: “Deleting the name only deletes the name; the commits themselves stick around as long as you can see them in git log --all, and actually even longer.”

    To visualize this better, run something like gitk --all or gitk --tags (try both on some complex git repos). Scroll around through the commits. Now imagine putting a sticky note on any commit. That’s a “tag” or “branch” name. Take the sticky note off. Commit is still there, right? 🙂

    That leaves one obvious question: when do things like commits actually go away? The answer is: only after you remove all the names that lead to them. The gitk command (like most other git commands) starts with the name HEAD. If you give it --all it adds all the branch names it can find. If you give it --tags it adds all the tag names it can find. Then it works backwards, looking at each commit to see what other commit(s) it refers to.

    Git removes things (commits, etc) when there is no way to find them by starting at one of these obvious names and working backwards. (Even then it waits a long time, 30 to 90 days by default.) So, if you add a branch or tag label to an old commit whose number you found by doing git log for instance, that gives you a new obvious name for that commit number; but removing again it is safe as long as it’s not the only way to find it by name.

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

Sidebar

Related Questions

Given that two branches have diverged and a specific commit from one branch (and
I have two branches in my Git repository: master seotweaks (created originally from master
In GitHub, I have two branches working and master branch. Now I wanted to
I have two branches, master and feature . I finished working on feature ,
I have two branches, master and dev. I always work on dev and only
I have two branches, master and feature1. I was working on feature1 when I
I have two branches master and exp i tried to cherry pick some of
Imagine the following situation: I have two branches: DEV and MAIN. I'm working on
I have two branches:master and v2. I want to merge v2 in master so
I have two branches: local branch (the one which I work with) remote branch

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.