1

In a folder in my project I am trying "git add images" (images is a folder). Nothing happens. I also went into the images and ran "git add ." and nothing happened.

In both cases "git status" tells me my branch is up to date.

What do I need to do?

5
  • Is it being ignored by gitignore? Commented Jun 5, 2018 at 22:26
  • @17slim - I don't think so. How can I test that? Commented Jun 5, 2018 at 22:27
  • Were the files already added? Commented Jun 5, 2018 at 22:27
  • In your repo directory, look at the .gitignore file and see if any of the rules there might match your folder. If so, remove/modify them so they don't. Commented Jun 5, 2018 at 22:28
  • Oh, and if it's empty it might lead to issues as well. As suggested here maybe add a .gitignore for now. (if you plan to put things in it, just leave the file empty and it might work) Commented Jun 5, 2018 at 22:31

1 Answer 1

2

First, if images/ is an empty folder, Git would not add it: it adds only files.
Adding just a folder requires indeed adding a file, like a .keep, or a .gitignore if you don't want to track its content.

Second, if images/ is a folder with files, and those files are not added, pick one of those untracked file (that you cannot add), and type:

git check-ignore -v -- images/afile 

That way, you won't have to check all .gitignore files: Git will do that for you, and print any .gitignore path (and the rule in it) which is responsible for images/ content (the files) to be ignored (you would need to do git add -f to force them to be added)

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.