A suggestion for git ignore file when building a project or package.

When we use RStudio to create a project or a package, there is an option to add git. If we choose it, there is automatically a git ignore file created. It ignores the .RData file to help us push our project to GitHub without trouble (file size > 50MB is a trouble).

But sometimes I find a file named by .RDataTmp created, I hope it automatically is added in the git ignore file.

You can edit your .gitignore file however you like.
You can either right-click on the name of the file in Git pane in RStudio and choose "Ignore file" or something like that or you can edit .gitignore file directly. It's just a plain-text file that has fairly straightforward (I think) form.
For example, in your specific case you can add something like *.RDataTmp on a new line in this file and it'll ignore all files with that extension in that folder. You can add paths as well as entire directories to this ignore file.

3 Likes