How to start tracking directories/files again which were removed from git index?

Using below command i removed few directories from git index:

git rm -r --cached <your directory>

Now how can i add those untracked directories to git index again?

  • How does staging a file modify the index file internally?
  • Where does “git update-index --assume-unchanged file” actually save this information to?
  • Git: What is the index
  • How to undo git update-index?
  • what is “stat information” in a git index?
  • Why do I need to tell git I've removed a file?
  • Is there a reflog for the index?
  • Why isn't it sufficient to just stage work-in-progress before switching branches? Why must I also commit?
  • One Solution collect form web for “How to start tracking directories/files again which were removed from git index?”

    Just add them again to your index using git add:

    git add <your directory>
    

    Note that this will add all files, and not only those that were removed with your previous command. There is no way to only undo your command.

    Git Baby is a git and github fan, let's start git clone.