Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitignore a folder content [duplicate]

Tags:

git

gitignore

Possible Duplicate:
Ignoring directories in Git repos on Windows

My web app has the following directory layout:

myapp/     .gitignore     .git/         ...      static/             mytest.txt             fgs.ico     ledgerware/         static/             mytest.txt             fgs.ico         ... 

I'd like to edit existing myapp/.gitignore file so that when git push it ignores all files inside myapp/ledgerware/static folder, but NOT myapp/static folder. Can someone help me with this?

like image 624
synergetic Avatar asked Feb 05 '13 05:02

synergetic


People also ask

How do I Gitignore the contents of a folder?

. gitignore is a plain text file in which each line contains a pattern for files or directories to ignore. It uses globbing patterns to match filenames with wildcard characters. If you have files or directories containing a wildcard pattern, you can use a single backslash ( \ ) to escape the character.

Can you Gitignore a folder?

A . gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository, and that's what I recommend. However, you can put it in any folder in the repository and you can also have multiple .

How do I ignore a folder in Gitignore?

If you want to maintain a folder and not the files inside it, just put a ". gitignore" file in the folder with "*" as the content. This file will make Git ignore all content from the repository.

Are Gitignore files cloned?

gitignore file. If a file is added, committed and another commit with the . gitignore is created, the file will still be part of the repository and therefore cloned.


1 Answers

Just make the line in .gitignore as specific as you want it to be:

ledgerware/static/* 
like image 196
FoolishSeth Avatar answered Oct 31 '22 14:10

FoolishSeth