2

When I create files in Unity editor or move already created files to another folder etc. - these files are not added to git by default. I have to manually add them to git in the Rider IDE. This becomes very annoing when I want to refactor project structure or when I add some prefabs and assets etc.

In Rider Settings -> Version Control -> Confirmation I tried "silent: and "show options..." options, but to no avail. Also if I create file in Rider project structure It will be added by default.

gitignore file:

# This .gitignore file should be placed at the root of your Unity project directory

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/

# Never ignore Asset meta data
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# TextMesh Pro files
[Aa]ssets/TextMesh*Pro/

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

git status command (.meta files were added to git when I marked whole folder to be added to git with this problem):

        new file:   Assets/Scripts/CatLikeLegacy.meta
        new file:   Assets/Scripts/CatLikeLegacy/EdgeVertices.cs.meta
        new file:   Assets/Scripts/CatLikeLegacy/FireTrail.cs.meta


... etc. meta files

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .idea/
        .vscode/
        Assets/Build.meta
        Assets/Build/provinces.png.meta
        Assets/Build/provincesReference.png.meta
        Assets/Materials.meta

...etc ignored files .meta in common

When file created or moved git should automatically track this file.

UPD: Tried to create new clean project in Unity and add git system from Rider - still this problem remains, new files are not tracked by Rider automatically (marked red).

14
  • Try the command line instead. Maybe also show what the output of git status? Commented Apr 1, 2019 at 8:45
  • >try the command line You mean try add new files with comand line? It is not that convinient either... Commented Apr 1, 2019 at 8:47
  • Convenient? I want to help you resolve an issue. There’s an issue and the best way to help resolve it is by using the command line. Commented Apr 1, 2019 at 8:52
  • Thank you, but the problem is that it will include a lot of manual work in future this way. Say I want to move all contents of one folder to another part of project - I will have to git add all files in that folder - It will be pretty annoying actually :) Commented Apr 1, 2019 at 8:56
  • The problem is not in that I can't add files to git, but is that files are not added to git automatically, I have to add them manually - whether from Rider IDE or from console git add Commented Apr 1, 2019 at 9:04

3 Answers 3

1

I've used Unity with Rider, but I currently don't know of a solution using Rider-native functionalities.

But you could work around the problem by using the CLI (Command line interface) and adding all your files at once (instead of one-by-one) with :

git add --all

This does 'require' you to have a decent .gitignore so you don't include bloat Unity and Rider files.

Here is an example of such : .gitignore

You might need to customize it a bit to your suiting; you can easily check what files would be included if you used git add --all by using the git status command, which should give you the necessary information to identify the exclusion patterns you need to add to your .gitignore

1

As I see from https://youtrack.jetbrains.com/issue/IDEA-52058 thx to @evolutionxbox, this feature is not yet implemented for JetBrains products - which makes very annoying work flow in this IDE for unity. Unfortunately.

0

Replace

!/[Aa]ssets/**/*.meta

by

!/[Aa]ssets/**/[\w\ \d\.]*.meta

as per this link i found. It says

Files can include spaces, which the current pattern doesn't capture. Example: Assets/Plugins/My Plugin.meta

Not the answer you're looking for? Browse other questions tagged or ask your own question.