Git discard changes in the working directory submodule

I work in a submodule and I have problems finding a folder full of files

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
    #   modified:   public/javascripts/app/fckeditor/editor/skins/office2003/fck_dialog.css
    #   modified:   public/javascripts/app/fckeditor/editor/skins/office2003/fck_editor.css
    #   modified:   public/javascripts/app/fckeditor/editor/skins/silver/fck_dialog.css
    #   modified:   public/javascripts/app/fckeditor/editor/skins/silver/fck_editor.css
    #   modified:   public/javascripts/app/fckeditor/fckconfig.js
    #   modified:   public/javascripts/app/fckeditor/fckeditor.js
    #   modified:   public/javascripts/app/fckeditor/fckpackager.xml

I am typing

git reset --hard

which returns

HEAD no longer has b2c5a77

However, when I print

git status

I am again met by a long list of files. I tried

git clean -f 

and also removed the entire submodule and removed it from the main server. I also tried to delete the entire project to which the submodule belongs, pulled it out, and then initiated and updated the submodule, but to no avail.

rm -rf project
git clone foo@bar.project.net:/home/rails/repo/gits/project.com
#Cloning into project...
#remote: Counting objects: 2452, done.
#remote: Compressing objects: 100% (2040/2040), done.
#remote: Total 2452 (delta 1238), reused 582 (delta 145)
#Receiving objects: 100% (2452/2452), 561.32 KiB | 438 KiB/s, done.
#Resolving deltas: 100% (1238/1238), done.
cd project.com
git submodule init
git submodule update
#Cloning into vendor/plugins/project_engine...
cd vendor/plugins/project_engine
$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   public/javascripts/app/fckeditor/editor/skins/office2003/fck_dialog.css
#   modified:   public/javascripts/app/fckeditor/editor/skins/office2003/fck_editor.css
#   modified:   public/javascripts/app/fckeditor/editor/skins/silver/fck_dialog.css
#   modified:   public/javascripts/app/fckeditor/editor/skins/silver/fck_editor.css
#   modified:   public/javascripts/app/fckeditor/fckconfig.js
#   modified:   public/javascripts/app/fckeditor/fckeditor.js
#   modified:   public/javascripts/app/fckeditor/fckpackager.xml

The only thing that seems to delete the files is if I log in as another use on my Mac, which makes me think of my problem with my local machine, and not with the repo itself.

I also tried uninstalling and reinstalling GIT and am currently installing 1.7.5.4 and doing it with brew (ruby package box).

GIT?

+5
4

, /. .

a git commit , , , . , , myfile myfile, git myfile, , / myfile, myfile.

, myfile myFILE . "", . git status, , .

, . git .

, , , . git status , dir :

$ echo >> public/javascripts/app/fckeditor/fckpackager.xml
$ git status
Possible outcome:
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   ...
#   modified:   public/javascripts/app/fckeditor/fckpackager.xml
#   modified:   public/javascripts/app/fckeditor/FCKPACKAGER.xml

git ls-files, , :

$ git ls-files public/javascripts/app/fckeditor/fckpackager.xml
public/javascripts/app/fckeditor/fckpackager.xml
public/javascripts/app/fckeditor/FCKPACKAGER.xml

, , git checkout-index, - ( , ):

$ git checkout-index --prefix=v1/ public/javascripts/app/fckeditor/fckpackager.xml
$ git checkout-index --prefix=v2/ public/javascripts/app/fckeditor/FCKPACKAGER.xml

, , , git rm --cached, :

$ git rm --cached public/javascripts/app/fckeditor/FCKPACKAGER.xml

, , git reset --hard


, . , .gitconfig.

+8

git clean -xdf

git clean -f

-d           .           git,           . -f , .

-           . ,           . (, git         reset), .

+2

. Mac , .

Git . , , , , git status ( , ). , (, fckeditor fckeditor), Git .

, , git clone .

+2

Go to the submodule directory - this is its own repo - before performing operations on this submodule repo. Then you can clean and repair the submodule repository in the โ€œusual wayโ€.

The various articles of the submodule (the progit and git community), although they mention it, are not as clear as it is necessary to select this point.

+1
source

All Articles