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

  • Home
  • SEARCH
  • 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 7907029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:14:09+00:00 2026-06-03T11:14:09+00:00

I have a detached head in git. I am not interested to make any

  • 0

I have a detached head in git. I am not interested to make any commit or save any changes, I just want to go to the head position of my branch. I have tried his command but it doesn’t work:

 git checkout MyBranch

Any help?

—- Update

when I trying to checkout, I am getting this message:

 $ git checkout -f master
 Switched to branch 'master'
 Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.

— update 2
It says thetre are some changes, How can I remove them?

$ git merge origin/master
Updating fb5972a..28c2849
error: The following untracked working tree files would be overwritten by merge:
  ---
Please move or remove them before you can merge.
Aborting

How can I discard them?

These commands did not work:

$ git checkout -- .


$ git stash save --keep-index
No local changes to save
  • 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-03T11:14:10+00:00Added an answer on June 3, 2026 at 11:14 am

    this probably happens because you’ve made changes to the detached head.
    try forcing the checkout, which will discard the changes, as you mentioned you don’t care about those.

    git checkout -f MyBranch
    

    from the git help checkout man page:

      -f, --force
          When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.
    
          When checking out paths from the index, do not fail upon unmerged entries; instead, unmerged entries are ignored.
    

    Switched to branch ‘master’

    So, you are on master branch now.

    Your branch is behind ‘origin/master’ by 6 commits,

    This means that the remote master branch, has updates, and that you may want to update your local branch to match the remote. You have already fetched the origin/master branch, thus git knows that your local branch is behind the remote branch.

    and can be fast-forwarded.

    This means that the remote branch has linear changes made to it, and that there will be no conflicts in merging/updating your local branch.

    To update the local branch, just merge the origin/master branch to it.

    git merge origin/master
    

    error: The following untracked working tree files would be overwritten by merge:

    this means that you have some files locally, that are not tracked (have never been git add’ed and commited) that the new changes (the merge) is going to add to the git list of files to watch and track. So the new files, that are going to be added, clutter with the local untracked files on the repo.

    To resolve that, either remove those local files, or rename them, or move them to another location and try to merge the remote branch again.

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

Sidebar

Related Questions

I have a question about hibernate. I want to save a small graph of
I have a hibernate object that gets detached and transferred to a thick java
I'm using Hibernate with Spring in my application. I have been consistently using detached
Have just started converting an existing job tracking system into an ASP.NET MVC application.
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I have a few windows in a single screen session and then I want
I'm not clear on what the following means (from the Git submodule update documentation):
Let's say I have started new thread with pthread_create() and then detached it using
I have this fragment that demonstrates the problem: <html> <head> <title>height query demo</title> <script

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.