If you want to use the RStudio interface to control git, you need to create a RStudio Project. To do so, you should first organize your files in one folder that will become your git repository. Once this is done, you can create a new RStudio Project from the upper-right corner of the RStudio IDE window, choosing New Project
Now, you have two options:
Create the Project based on an existing folder (e.g., you already have been working and writing code and you want to start using git versioning on this work)
Create the Project from scratch based on a new empty folder