1

Git noob here...I tried to reset my index in my git repo so that I could add my .gitignore file and have it ignore things.

So I did this:

git rm -r --cached . git add . git commit -m "making .gitignore ignore" 

and then when I pushed it to github one of my main project folders(django project) is suddenly black and I can't click on it or anything. It seems like the files just didn't get added back to the index but I'm not sure why. I've tried adding them back but commit then tells me there is nothing to commit even though it also says the folder has been modified.

I'm having other issues but I guess my main worry is that I will lose my project in its current state because I finally have some tweaks working.

Why is the folder black and how can I make it blue again?

1
  • "black"? "blue"? What does your .gitignore contain? Commented Aug 3, 2013 at 13:13

1 Answer 1

1

git rm -r --cached . untracks all your files in a directory, leaving them as simple files on your drive. That's why you still see them on your local repo, but they disappeared on GitHub.

To roll back to previous state, assuming you didn't commit anything after the rm commit, do:

 git reset --hard HEAD~ git push --force 

Instead, you'll want to selectively remove the files you want to ignore with git rm --cached <files>, add them to .gitignore, and commit.

Sign up to request clarification or add additional context in comments.

2 Comments

head~ and head^ are the same here, ^ is the first parent, and ~ is the first ancestor
Odd. I could've sworn HEAD~ gave me an error the last time I tried to use it. Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.