9

I added a Laravel App under Git so that I could push to Bitbucket. On root folder, I ran git add -A and pushed on remote server. I checked that it did not send all folders; for instance, it did not add vendor folder at all. How do I make sure that all subfolders are added? When I run git status, it says:

# On branch master
nothing to commit, working directory clean

Update

I ran git status --ignore and found the following files listed:

stocktrack/app/storage/logs/laravel.log
stocktrack/app/storage/meta/services.json
stocktrack/app/storage/sessions/cdf664ccf42d040bc92d76418f736cc78e20d77a
stocktrack/app/storage/views/81774cd762e1fa0174ad42e0b0d53196
stocktrack/bootstrap/compiled.php
stocktrack/composer.lock
stocktrack/vendor/

In .gitignore, I only added .idea. Why did it ignore the others?

jub0bs
  • 60,866
  • 25
  • 183
  • 186
Volatil3
  • 14,253
  • 38
  • 134
  • 263
  • 2
    Note: `GIT_TRACE_EXCLUDE=1 git status` will soon (git 2.8, March 2016) be an additional way to debug `.gitignore` rules. See http://stackoverflow.com/a/18953923/6309 – VonC Mar 01 '16 at 16:12

4 Answers4

20

You can use git check-ignore to determine if a path is getting ignored by git.

Furthermore check-ignore offers a -v (--verbose) option which will tell you about the pattern that ignores your file and where you can find it.


Let's assume you have a repository with the following directory structure.

bar/test/important
foo/a.tmp
foo/b

And this .gitignore file.

bar/
foo/*.tmp

You wonder why your important file in bar/test/ is getting ignored.

This is a pretty bland example, but it just serves to show the concept.

Now let's check which pattern ignores your important file.

$ git check-ignore --verbose bar/test/important
.gitignore:1:bar/       bar/test/important

As you can see, check-ignore tells you that the pattern bar/ in your .gitignore file on line 1 ignores the path in question.

Sascha Wolf
  • 18,810
  • 4
  • 51
  • 73
4

git add --force <Specific Folder> did the trick with me.

Volatil3
  • 14,253
  • 38
  • 134
  • 263
  • 1
    That's merely a treatment of the symptoms. It makes more sense to solve the problem at it's root. Take a look at [my answer](http://stackoverflow.com/a/28600789/2274224). – Sascha Wolf Feb 19 '15 at 09:14
  • This isn't a permanent solution. Problem will re-occur on the next branch. – IgorGanapolsky Jun 08 '21 at 19:18
1

The issue I had, and most likely you had is that .git/info/exclude had these folders listed in it. I had to remove them from there. Then I ran:

  1. git rm -r -f --cached .
  2. git add .
IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
-1

It seems .gitignore works.

Check your repository's root directory. You will find a file .gitignore which includes file names to be ignored.

shirakia
  • 2,369
  • 1
  • 22
  • 33