Jan Moritz
Jan Moritz

Reputation: 2215

Unable to delete files from remote Git repository

Actually I have some folders that are in my .gitignore files

composer.phar
vendor
build
.idea

Unfortunately when I added this entries some of the files where already on the remote repository and now I'm unable to remove them from there.

I ran git rm --cached as it was suggested in many places but now I'm blocked.

If I run git status here is the result:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   deleted:    .idea/BitcoinECDSA.php.iml
#   deleted:    .idea/workspace.xml
#   deleted:    build/junit.xml
#

Whereas if I try to commit these changes I get :

git commit . -m "removed files"

# On branch master
nothing to commit (working directory clean)

Upvotes: 0

Views: 372

Answers (2)

Greg Bacon
Greg Bacon

Reputation: 139411

Short answer: run git commit -m "removed files" (i.e., remove the dot).

git commit told you it has nothing to commit because of the way you invoked the command. You have a path on your command in the question, namely ., and according to the documentation that tells git to do something other than what you intend.

<file>

When files are given on the command line, the command commits the contents of the named files, without recording the changes already staged. The contents of these files are also staged for the next commit on top of what have been staged before.

Because the files in .idea and build are ignored, there is nothing to record in this mode.

Upvotes: 1

Jason S
Jason S

Reputation: 13779

Try git commit -a instead of git commit . which is looking for files in or under the present directory to commit.

Upvotes: 1

Related Questions