1

I am very new to git. What I did so far in it was this:

    $git init
    $git add "folder/*.php"

Now, I cannot remove the php files from the staging phase... what it returns:

    $git rm --cached "folder/*.php"
    fatal: 'folder/*.php' is outside repository

What do I do now? my git version is 1.7.1

Slackware
  • 960
  • 1
  • 13
  • 29
  • I tried the same sequence of commands and it worked for me... – ulmangt Sep 09 '12 at 04:27
  • This question looks like a duplicate of: http://stackoverflow.com/questions/348170/undo-git-add-before-commit – ulmangt Sep 09 '12 at 04:37
  • 1
    If there are no commits yet, you are probably faster if you just remove the Git directory (`rm -r .git`) and start anew. – knittl Sep 09 '12 at 07:02

1 Answers1

1

First, the error occurs because those files are not added to the repository yet. When you do a git add, what git does is just to add files into a "list" that will be commit to the repository.

In order to "make these files part of the repository", what you can do is:

git commit -m "first commit"

Then:

git rm folder/*.php

Now since you remove files, you need to commit again to update git history about the remove.

u19964
  • 3,255
  • 4
  • 21
  • 28