Jürgen Paul
Jürgen Paul

Reputation: 15017

Un-ignore a directory added to .gitignore

What I did was to have two branches:

In my local branch I have all my asset folders css, js, and img. And in my production branch I added them to my .gitignore since I want to host those assets elsewhere.

css/
img/
js/

so these folders aren't visible in the production branch anymore. Is there anyway to restore the img folder in the production branch? I tried removing img/ from my .gitignore and committing but it won't list on my untracked files.

Upvotes: 2

Views: 2297

Answers (2)

Nevik Rehnel
Nevik Rehnel

Reputation: 51965

After removing img/ from your .gitignore, you can git checkout local -- img to check out the files from the local branch (assuming you are on the production branch). They should automatically be staged (otherwise just stage them yourself), and commit them to your production branch.

Upvotes: 1

Gone3d
Gone3d

Reputation: 1189

Take a look at this: Not ignore a file in a sub directory?

It should work for the folder as well

Upvotes: 0

Related Questions