Unable to discard all local files in git -


i have 2 files in working directory. want discard these files can switch branches.

there many helpful guides online, , have tried every answer can find remove these files, yet still persist.

user@machine:~/code/foo$ git status changes not staged commit:   (use "git add <file>..." update committed)   (use "git checkout -- <file>..." discard changes in working directory)      modified:   src/test/foo.c     modified:   src/test/bar.c 

commands have tried based on other stackoverflow questions.

 git reset    git reset --hard head^   git stash save --keep-index  git stash drop   git checkout head -- $(git ls-files -m)   git clean -f  git clean -dfx   git checkout -- .   git checkout -- *   git checkout 123456   git reset --hard 123456   git reset head --hard 

amazingly, after every command, find files still present!

user@machine:~/code/foo$ git status changes not staged commit:   (use "git add <file>..." update committed)   (use "git checkout -- <file>..." discard changes in working directory)      modified:   src/test/foo.c     modified:   src/test/bar.c 

since there 2 files, know could recheck them out 1 one. if happened again , had 100 files, want know procedure blow of them away in 1 sweep.

 git checkout src/test/foo.c  git checkout src/test/bar.c 

update

aparently not git checkout works

git checkout src/test/foo.c echo $? 0 git checkout src/test/bar.c echo $? 0  user@machine:~/code/foo$ git status changes not staged commit:   (use "git add <file>..." update committed)   (use "git checkout -- <file>..." discard changes in working directory)      modified:   src/test/foo.c     modified:   src/test/bar.c 

these files wont go away.

update2

i've tried these command no luck.

git reflog git checkout head@{17}  git init git reset --hard head^ 

update3

stashing nothing.

git checkout master git stash git stash pop git stash drop 

deleting files not work either.

user@machine:~/code/foo$ git rm --cached $(git ls-files -m) rm 'src/test/foo.c' rm 'src/test/bar.c'  user@machine:~/code/foo$ git status on branch master branch behind 'origin/master' 162 commits, , can fast-forwarded. (use "git pull" update local branch)  changes committed: (use "git reset head <file>..." unstage)      deleted:   src/test/foo.c     deleted:   src/test/bar.c 

this sounds line-ending troubles, you've told git automatic conversions on checkin , result of conversions won't match committed state. check .git/info/attributes , .gitattributes text attributes:

text

this attribute enables , controls end-of-line normalization.when text file normalized, line endings converted lf in repository.

if has checked in files containing crlfs, understand text=auto way to, erm, find them.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -