Sometimes, when we do a ‘git status’ command, it displays unwanted files, asking us to track them. Ex:
git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Untracked files:
(use “git add <file>…” to include in what will be committed)
atlassian-ide-plugin.xml
nothing added to commit but untracked files present (use “git add” to track)
In my case, it shows a plugin related file from my ide( atlassian-ide-plugin.xml). I don’t want this file to be shown in the git status command, but i need to have it in my working directory, in my hard drive.
Having such a line can be a distraction some times. So what can we do?
1. Go to your project root folder, and open the ‘.gitignore’ file at there.
2. Insert the unwanted file name there & save.
Ex: my .gitignore file
# Ignore everything in this directory
target
.classpath
.settings
.project
*.iml
*.iws
*.ipr
.idea
atlassian-ide-plugin.xml
3. Now do a ‘git status’ & see. That file & related message will not be shown again.
Sometimes, after that the console will show the following message.
git status
Changes not staged for commit:
(use “git add <file>…” to update what will be committed)
(use “git checkout — <file>…” to discard changes in working directory)
modified: .gitignore
Untracked files:
(use “git add <file>…” to include in what will be committed)
.gitignore~
no changes added to commit (use “git add” and/or “git commit -a”)
In this case, you can commit your updated ‘.gitignore’ file to your repository, so anyone using your repo will have the same file ignore configurations.
As for ‘.gitignore~‘ file , simply delete it manually.