Changing the default gitignore file when creating a new project

Is there a way to change the default .gitignore file that Android Studio creates when creating a new Android project? I looked for it in the settings, but did not find anything.

+6
source share
2 answers

Unfortunately, there is no way to do this automatically, except for the one Ted was talking about. However, I personally do not see this as a big drawback, because you can safely add your specific templates that are best suited for your project. To do this, do the following:

Go to File -> Settings and from there select Plugins . Click Browse repositories... and you can find a plugin called .ignore. Install it.

Now, to configure .gitignore for any project, in case you did not open the project, click ConfigureSettings . If you have an open project, go to File -> Other Settings -> Default Settings… Now expand Version Control and click Ignore Files Support . You should be able to add a custom template for your .gitignore file there.

To use any template that you added there, simply right-click on .gitignore and click Add template… You can add your own specifications there, but many others are provided by default, so you don’t need to search Google for the .gitignore setting for the OS or language.

+2
source
Good question. I tried to manually change the project_ignore template in the Android Studio installation (located in C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle-projects\NewAndroidProject\root in my Windows installation). This works, but it will crash any future updates for Android Studio if you do not restore the original template first.

I am posting this as an answer because it works. But this has such a bad side that I also start generosity in the hope that someone can come up with a better solution.

0
source

Source: https://habr.com/ru/post/986513/


All Articles