0

I was fooling around in GitEye by mistake i double clicked on a tag. And my repository checked out to that particular tag and

git status give the following output HEAD detached at added-MySQL-cnf. I just want to go back to my master branch. I followed this link and created a new tmp branch. Now when i execute git checkout master which should checkout to master branch it says.

git checkout master
error: The following untracked working tree files would be overwritten by checkout:
    docs/make.bat
    scripts/mysql_backup.bat
    scripts/run.bat
Please move or remove them before you can switch branches.
Aborting

git status         
On branch tmp
Untracked files:
    (use "git add <file>..." to include in what will be committed)

    ../docs/
    ../scripts/

nothing added to commit but untracked files present (use "git add" to track)

and

git stash
No local changes to save

I have no idea what to do. Can please someone help me i just want to go back to my master branch.

Community
  • 1
  • 1
Vaibhav Jain
  • 5,287
  • 10
  • 54
  • 114
  • Try `git stash save -include-untracked`, then `git checkout master`. – jub0bs Oct 17 '14 at 13:12
  • `git stash save --include-untracked warning: LF will be replaced by CRLF in scripts/mysql_backup.bat. The file will have its original line endings in your working directory. Saved working directory and index state WIP on tmp: 96c9a7b added MYSQL configuration file HEAD is now at 96c9a7b added MYSQL configuration file Unlink of file 'docs/make.bat' failed. Should I try again? (y/n) y Unlink of file 'docs/make.bat' failed. Should I try again? (y/n) n warning: failed to remove docs/make.bat` Still no luck. – Vaibhav Jain Oct 17 '14 at 13:18
  • Please edit `git stash save -include-untracked to git stash save --include-untracked` – Vaibhav Jain Oct 17 '14 at 13:20
  • I can't edit my comment anymore because it's too old, but you're right: a `-` was missing. – jub0bs Oct 17 '14 at 13:23
  • Try moving those three files to a different directory manually, then check out master. Or then reclone the repo. – tom Oct 17 '14 at 13:24
  • `git checkout -f master` worked. Now my repo HEAD is at `master` branch – Vaibhav Jain Oct 17 '14 at 13:31

0 Answers0