Neofrost
Neofrost

Reputation: 1

.gitignore does not exclude filetypes from ignored directory content in Sourcetree

In my Unreal Engine project directory there is a Build directory and I want to ignore all the files inside except for the png files and the keystore. I want to commit my project with Sourcetree to an empty repository which has only the README.md file.

Inside .gitignore file i have the following rules:

# Builds
Build/*

# Don't ignore icon files in Build
!Build/**/*.ico

# Don't ignore image files in Build
!Build/**/*.png

# Don't ignore keystore file in Build
!Build/**/*.keystore

Inside my project directory looks like this:

|   .gitignore
|   README.md
|
+---Build
|   +---AllDesktop
|   |   \---FileOpenOrder
|   |           CookerOpenOrder.log
|   |
|   +---Android
|   |   |   MyAndroidApp.keystore
|   |   |   project.properties
|   |   |
|   |   +---FileOpenOrder
|   |   |       CookerOpenOrder.log
|   |   |
|   |   +---res
|   |   |   +---drawable
|   |   |   |       downloadimageh.png
|   |   |   |       downloadimagev.png
|   |   |   |       icon.png
|   |   |   |       splashscreen_landscape.png
|   |   |   |       splashscreen_portrait.png
|   |   |   |
|   |   |   +---drawable-hdpi
|   |   |   |       icon.png
|   |   |   |
|   |   |   +---drawable-ldpi
|   |   |   |       icon.png
|   |   |   |
|   |   |   +---drawable-mdpi
|   |   |   |       icon.png
|   |   |   |
|   |   |   +---drawable-nodpi
|   |   |   |       vr_icon.png
|   |   |   |       vr_icon_background.png
|   |   |   |
|   |   |   \---drawable-xhdpi
|   |   |           icon.png
|   |   |

The problem is that everything inside Build is ignored but I need to keep the png files and the keystore. I was inspired by the UnrealEngine.gitignore. What am I doing wrong ?

I want to add that it is a fresh install of sourcetree. Sourcetree also installed git, I did not have git previously installed. I don't have a global gitignore.

Upvotes: 0

Views: 513

Answers (2)

Internetkun
Internetkun

Reputation: 11

This is a bug with Sourcetree first noticed in 2015 that remains unresolved to this day:

SourceTree for Windows does not fully honor git's gitignore pattern format.

You can check out for more details the issue jiira SRCTREEWIN-3883

Upvotes: 1

Nathan Cregut
Nathan Cregut

Reputation: 1

You can try recreating the gitignore file, or possibly using a predefined gitignore for unreal engine. https://www.gitignore.io/api/unrealengine

That has a lot more rules but could be a start.

Upvotes: 0

Related Questions