user1941537
user1941537

Reputation: 6695

Git - Freshly pulled branch shows untracked files

Just pulled a branch which another developer was working on it. I haven't changed anything at all. Just pulled and run git status and git shows that ../.eslintcache is untracked and is suggesting to include it in what will be committed.

What should I do? I don't think that I should add and commit it.

Upvotes: 9

Views: 4314

Answers (2)

Rumid
Rumid

Reputation: 1707

It's a leftover of you previous work.

  • How it appeared?

Either you made linting, ot is is a part of some other job/script. In .eslintcache some linters caching occurs, and during this process it was created.

  • Why it didn't disappear when you checkouted other branch?

When you checking out new branch all untracked files will be still reside in you directory, unless there will be some conflicts.

  • How to avoid this?

You should add generated files (like .eslintcache) which you don't want to appear in git status, to be omited by git to .gitignore.

Upvotes: 4

X A
X A

Reputation: 837

Add folders and files you don't want to have in your repo to .gitignore

Here is more info about that file: https://git-scm.com/docs/gitignore

For instance files generated by IDEs and tools used while development are usually added there. Like .eslintcache folder added by eslint. This might happen because you added this folder to your IDE, which probably runs linting and other check ups running in the background.

In your case .gitignore might look like:

.eslintcache

#JetBrains IDE
.idea/

Upvotes: 9

Related Questions