6

I'm managing my Unity 2019.3 project in git and I have a directory called Packages in the root of my project. In here there is a file called manifest.json. Is this the only file that matters in the folder or are there other configuration files that could be generated and need tracking?

In other words, is it safe to put the following lines in my .gitignore

/[Pp]ackages/*
!/[Pp]ackages/manifest.json

This is very similar to this question but it doesn't explicitly answer what I want to know.


Edit

To clarify, I am asking if manifest.json will always be enough to regenerate the content of Packages or if there may be other files that are stored in there and required for configuration. I.e. files that won't be the same if left for automatic regeneration by Unity.

The use of this is I have an asset that adds files to that Packages folder and they do not need tracking. They are automatically added back in by the asset when needed. So I want to exclude all but the necessary files from that folder. If the necessary files could change and there is no way for me to know what configuration files could be generated, then I will not do this. If manifest.json is going to always be the only file of importance in that folder, I will leave my .gitignore as it is.

Dan
  • 7,286
  • 6
  • 49
  • 114
  • There is a site called gitignore.io, where you can download a pretty good .gitignore template file: `https://www.gitignore.io/api/unity` – IamK Sep 23 '19 at 09:45
  • This file keeps the list of packages and versions loaded, you should keep it with your project – BugFinder Sep 23 '19 at 09:45
  • @C1sc0 Thanks for the link. I was aware of that, thank you. However, it does not provide reasoning for why certain files are / aren't tracked so that is part of the reason why I posted my question. – Dan Sep 23 '19 at 09:47
  • @BugFinder Thanks for the comment. I am aware that the manifest file keeps track of which packages are used. If you look at the `.gitignore` extract you will see I am ignoring everything in Packages except the `manifest.json` file. My question is whether it is safe to do that or if there are other configuration files that could be generated that need tracking. Very much like `manifest.json`. – Dan Sep 23 '19 at 09:49
  • @Downvoter, why the downvote? – Dan Sep 23 '19 at 09:49
  • github has a good ignore list too.. – BugFinder Sep 23 '19 at 09:54
  • Here is some information about the `Packages` folder: [https://gamedev.stackexchange.com/a/174646/122543](https://gamedev.stackexchange.com/a/174646/122543) – IamK Sep 23 '19 at 09:54
  • @BugFinder Thanks for that. Unfortunately I am not after a general `gitignore` list. I am asking about a specific bit of my `gitignore` – Dan Sep 23 '19 at 10:02
  • Kinda disagree, all the generic lists include all the compulsary parts and non conpulsary parts of any unity project if you are not aware of any other non compulsary portions the default template is sufficient. Why reinvent the wheel – BugFinder Sep 23 '19 at 10:31
  • @BugFinder I'm not trying to reinvent the wheel. I'm actually using the [github Unity gitignore](https://github.com/github/gitignore/blob/master/Unity.gitignore) but with the two lines from my question added. I would have to disagree with your "one size fits all" gitignore opinion. My current case is I have an Unity Asset that modifies the package folder with information that does not need to be tracked. This is why I have added the two lines above and why I am asking if anyone knows whether `manifest.json` is the **only** file that needs to be tracked. – Dan Sep 23 '19 at 10:45
  • oh ok I see thanks for the clearification .. my bad. Regarding the Packages: yes it is the only file .. the PackageManager will then download the according files (which btw are directly built to the Library folder). The other two folders you always need are `Assets` and `ProjectSettings` ... all the rest can basically be deleted – derHugo Sep 23 '19 at 15:46
  • @derHugo Ah thanks. I appreciate it. I just wasn't sure if other config files might be generated in the future and if they were, I didn't want to accidentally ignore them. Feel free to post an answer :) – Dan Sep 23 '19 at 19:28

1 Answers1

4

Revisiting this a few months later. I still have found no documentation to confirm manifest.json is the only file that matters in the Packages directory, however, I have not had any issues with adding those two lines to several different Unity projects that use several different packages. It seems pretty safe to add.

Dan
  • 7,286
  • 6
  • 49
  • 114