Search code examples
gitgit-bash

Why a file named `tatus` keeps appearing in my git repository?


Several times a day, I run git status and I see that a new file named tatus has been created.

me@myself MINGW64 ~/path/to/my/repo (mybranch)
$ git status
On branch mybranch
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        tatus


It took 2.36 seconds to enumerate untracked files.
See 'git help status' for information on how to improve this.

nothing added to commit but untracked files present (use "git add" to track)

There is really a file named tatus in the working directory. It seems to contain a diff or something like that. There are also some control characters, which makes me thing that this is actually a problem with GIT bash doing something weird with the input/output redirection. If I had to guess, the name tatus comes from the command that I run, git status, and somehow git s gets dropped and the rest, tatus, becomes the filename for a diff.

What could be causing this?


Solution

  • This is too funny. I commented on this question earlier today, and then pretty much forgot about it. This evening I was working and I just typed git status and I couldn't believe my eyes when I saw an untracked file named tatus in my current directory. AFAIK this has never happened to me before, and what are the chances that it does happen, on the same day that I read your question! So I hit up arrow to see what I just did, and my last few commands were a script I ran, followed by git log, then git status. At first I thought it was the script, but I was able to rule it out. So now, fellow Git Bash user, think about what happens when you type git log, and also, like in your case, when you type git diff:

    If the output will take up more than 1 screen, they use the less program for paging. You have a colon at the bottom so that you can run commands, like <space> for the next page, or q to quit, or s to create a log file in which it prompts you for the log file name. So if you are in a paging diff or log, (and you forget to type q to quit), and you type git status, the git is ignored because those aren't less commands, then s prompts for the log, and tatus is your log file name.