✅ Using git in rider
Hello guys, it's my first time using a version contrl system (git) on rider. When I need to choose my "unversioned" files to commit, I have my .cs files where my codes are but also, I have my solution and my project folder. Can I just add my solution and just leave everything else as they are? Or will this track unnecessary files like .dll files or other files that are hidden. Or I need to specifically choose the folder I want where my .csproj is ?
28 Replies
well I don't have my project folder but I have the .csproj file of that folder
but I do have the solution though


see there are a lots of hidden files by default, so if I choose my .csproj or solution directly, will this also keep track of these files? (we don't want to keep track of them, right ?)
Or I noticed that we have a .gitignore which is automatically generated, may be it already contains pattern to exclude those files?
Create a default .gitignore file
A bunch of those files, like everything in
/obj
or /bin
doesn't need to be commited
dotnet new gitignore
if you need to generate ithmm the thing is, I can't see the obj or bin folder, I think I only see what's in there

They're not visible in the project view, since you're not meant to interact with them manually
may be the problem is this:

noticed I created my .git folder outside my project folder
Rather, the issue is that the
.gitignore
is not on the solution levelyeah, I'm lost :c.... why is the .gitignore not in the same location as the .git folder? Was it a good idea to create the .git folder in the solution level? Notice this image, the user can directly add a folder directly to a gitignore file

You want a structure like this:
yeah I see, here the .gitignore is not there
Yep
Open the terminal in Rider, and just do
dotnet new gitignore
in the solution diryep
it would be wrong to just move the .gitignore files where the unversioned files was pointing to? I noticed there are already some contents in them but the bin or obj folder is not included though, have a look

That's Rider's default gitignore
yeah, I will just let it here, I created the .gitignore, look how clean the unversioned file is now

Yep
nice, now the thing is, should I keep track of the solution itself or the csproj? or this depends on what I want, like to keep track of everything globally or just related to this project?
Wym "keep track of"?
like, the unversioned files are the files not in the staging area (I think), so in order to commit the changes, I can either add the .csproj which is related to only 1 project or the solution which is global no? (I think, may be I'm wrong :c)
Add everything in the repo
Solution isn't in any way global
It's just a way to keep multiple projects together
oh I see, I think I had a missconception... please, consider these image:
I'm confused here, the .sln folder contains details about how each project are related (I obtained it just to have a look of what it looks like and it's organised as above). What I don't understand is, the LibraryManagement, is just a simple folder? Because look at my IDE, it shows "solution" but a solution isn't just a file, like the .sln file ?



The folder that has
.sln
or .slnx
file in it is shown as the purple one, the solution
The folder that has .csproj
file in it is shown as the green one, the project
They are simple folders, in no way special
Rider and other IDEs just show them in this more conceptual way, rather than raw filesystem tree
You'll notice that Rider doesn't actually show the .sln
and .csproj
files here
But you can right-click the green "folder" and get all the .csproj
settings
Or even edit it as textoh ok
Yeah, in fact, I just noticed that we can just switch from "Solution to File system" in rider, here is what it looks like

yep
yep I see, make more sense now, I thought that a solution was a special folder but it's just a "special" file
works fine now, thanks once more !