Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ignore all files in a folder with a Git repository in Sourcetree?

I have a Bitbucket Git repository managed with Sourcetree.

I have two folders that I want to commit, but I need to ignore all the files in these folders, because they contain only temporary files.

How can I do that?

like image 446
rubdottocom Avatar asked Mar 12 '12 10:03

rubdottocom


People also ask

How do I ignore files in Sourcetree?

Easiest way to edit the individual, is right click the file. Click Ignore and select the option to ignore just in this repository then you will see a new file called . gitignore in the list.

How do I ignore files in a folder in Git?

Personal Ignore Rules Patterns that are specific to your local repository and should not be distributed to other repositories should be set in the . git/info/exclude file. For example, you can use this file to ignore generated files from your personal project tools.

How do I ignore files while pushing to Git repository?

Use your favorite text editor to open the file called .git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.


1 Answers

For Sourcetree users: If you want to ignore a specific folder, just select a file from this folder, right-click on it and do "Ignore...". You will have a pop-up menu where you can ignore "Ignore everything beneath: <YOUR UNWANTED FOLDER>"

First menu

Second menu

If you have the "Ignore" option greyed out, you have to select the "Stop Tracking" option. After that the file will be added to Staged files with a minus sign on red background icon and the file's icon in Unstaged files list will change to a question sign on a violet background. Now in Unstaged files list, the "Ignore" option is enabled again. Just do as described above.

like image 182
Kalzem Avatar answered Oct 26 '22 19:10

Kalzem