10

I am trying to add gradle.properties like rest but still changes that files changes are showing in git status.

Is there any other way to add files in git-ignore using android studio.

0

3 Answers 3

31

You should use git rm to untrack the gradle.properties file first.

git rm --cached gradle.properties
git commit -m "Remove gradle.properties"

Then add the following line to your project .gitignore file

gradle.properties

Commit and push that and any new changes to this file should not be tracked.

Sign up to request clarification or add additional context in comments.

Comments

3

It seems you already added this file to repo, and then you want to ignore it. In this case your file exists in Index/Staging area so git is showing it into changed file list.

So you need to remove this file from Index/Staging area, to do so you just need to clean git cache. Execute below command

git rm --cached gradle.properties

Read more details about Untrack files already added to git repository based on .gitignore

Comments

0

Simplest way use gitignore plugin and just right click the file which you want to hide and and you'll see add to gitignore option, select it and its done.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.