GIT not tracking files

david.colais picture david.colais · Jan 15, 2013 · Viewed 24.5k times · Source

I have setup GIT on AIX 6.1 and am facing problems.

The sequence of steps I followed are as shown:

  1. I create a folder.
  2. Go into the folder and initialise the non-bare repository
  3. Initialise the username and user email
  4. Create a file named index.html with some data in the file.
  5. Create a subfolder named newfolder
  6. Go into the newly created folder.
  7. Create a new file named index-2.html with some data in it.

After performing all the steps above and give the git status command I'm getting the foll result:

# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       ../index.html
#       ./

I understand that index.html in the above directory is getting displayed but why doesent index-2.html not getting displayed which is in the current directory.

The file index-2.html should also get tracked right.

Answer

poke picture poke · Jan 15, 2013

The output shows two things that are currently untracked:

  • ../index.html – the index.html file in the parent folder
  • ./ – the current folder, including all its contents

So it does detect that you have an untracked file, but because it does know nothing about its folder as well, it just shows the folder to accumulate all its content.

If you add your files and make Git track them, they will show up correctly:

git add index-2.html
git add ../index.html