How to ignore all files and folder of a folder, but not the folder itself?
Trying to ignore files and folder of a parent folder but want to upload the parent folder? Well, you are the right place ?. Let me show you how you can do that, the easiest way.
Let’s first create a folder. In Laravel, you will see
resources folder. Add
pending folder under
resources folder. So the new folder location looks like this.
Now goto the pending folder by using following command.
It’s time to create a file called
.gitignore under pending folder like this.
nano creates new file for you and makes ready to write content on it. After typing
nano command you will see plan text editor. Within that plan editor, paste the following lines of texts.
* */ !.gitignore
Once you are done typing above texts, do as follows.
You have successfully saved file. If you are not able to write, just add
sudo text in front of
nano .gitignore. It’s time to
git and here are the steps to do it.
- Go to root direction where you commit your project. Use
cd ..to go backward.
git add .
git commit -m "Added pending folder in resources folder."
git push origin master
That’s all. You successfully added new folder and now all sub files and folders of
pending folder will be ignored.
Hope this is helpful. Let me know if you need help. And don’t forget to share.