How to check all your untracked git files in the terminal.

Fredric Cliver
2 min readFeb 15, 2023
Photo by Gabriel Heinzer on Unsplash

Sometimes, when you periodically change your machine. You’d never expected that you might lose your codes. Cause you always use git.

But how about you haven’t tracked a few essential files?

Pods folder and node_modules are no problem, but how about regular code or environment files?

That is, you need to be careful and do double-check.

Here is a command to check all of the untracked and ignored files

List ignored files

$ git ls-files . --ignored --exclude-standard --others

List untracked files

$ git ls-files . --exclude-standard --others

You can use grep with the invert option to see all untracked files except specific directories, such as the Pods directory.

$ git ls-files . --ignored --exclude-standard --others | grep -v Pods
including Pods directory
Excluding Pods directory

Don’t forget to check whether your repository is perfectly synced as follows as your expectancy.

--

--

Fredric Cliver
Fredric Cliver

Written by Fredric Cliver

Physics graduate with 13 years of diverse experience in the IT industry. Founded and managed a startup for 3 years.

No responses yet