top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

GIT: Getting "nothing added to commit but untracked files present " console output while running $git status command .

+2 votes
1,078 views

When does git shows message "nothing added to commit but untracked files present " ?

posted Mar 5, 2016 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+3 votes

"nothing added to commit " signinfies that all ur staged changes are committed, so no file is under staging area.
"un tracked files present" signifies that you have added new files locally and going to add in to the repository(file state moving from un tracked to tracked) ,so to add in to staging area and then commit it.

Hope now you are clear on git status output.

answer Mar 6, 2016 by Sachidananda Sahu
Thanks Sachidananda. I have not added any new files, actually when I compile my code then object files gets generated and show as untracked. Can I do something to avoid such type of messages ? If yes then where exactly ?
Yes for sure git provides a feature known as git ignoring files,

so just create a .gitignore file in your repository and mention there about which files you don't want to track so while running git status command, git will ignore those files.

So all temporary files like object files, executable files will be mentioned in this file.

If you want to ignore object files then mention like this in the .gitignore file
*.o
Similar Questions
+2 votes

In coreboot we try to check for whitespace errors before committing. Of course a pre-commit hook is the way to go, but unfortunately it is not so simple (at least for me) as the following requirements exist.

  1. Only the files actually committed should be checked. That means running git commit -a, abort that and then running git commit some/file should only check some/file for whitespace errors.

  2. There are certain files that are allowed to have whitespace errors. In our case these are *.patch and *.diff files which by design seem to contain whitespace error.

Currently the whole tree is checked, which takes a lot of time. I tried to come up with a patch, but failed so far. Best would be to have

$ git diff --check --only-committed-files --exclude "*patch$"

where I could not find a way for the last to switches.

Currently, I would use

$ git diff-index --cached --name-only $against -- | grep -v patch$

and pass that list to some whitespace check program. Unfortunately that still does not fulfill the first requirement. What am I missing to solve this elegantly?

+2 votes

I am trying to clean untracked files and running into following error,can anyone one help on how to overcome this?

$ git clean -f -d
warning: failed to remove DT_Nfc_types.h
warning: failed to remove DT_Nfc.h
+1 vote

In git version 1.8.2.3 (in arch) I'm getting this message when doing git commit -a

fatal: empty ident name (for ) not allowed

I get this message in a brand new repository. I'm getting the same message in Ubuntu 12.10 which has 1.8.1.2

The message suggests I do

Run

 git config --global user.email "you@example.com"
 git config --global user.name "Your Name"    to set your account's default identity.

but I've done this

[tim@newton git_scratchpad]$ git config -l
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

git works as I expect on another machine with 1.7.9. I'm at my wits end and I don't know what to do.

0 votes

If I run "git commit", Git will output a lot of detailed information about the commit:

$ git commit -m 'Daily update.'
[master bb56ea6] Daily update.
1477 files changed, 183898 insertions(+), 8 deletions(-)
rewrite GTD/Email.ods (72%)
create mode 120000 [etc.]
$

If I run "git commit -q", Git will output nothing:

$ git commit -m 'Daily update.'
$

Is there an option to get "git commit" to output just the first line,
giving the commit hash, like this:

$ git commit -m 'Daily update.'
[master bb56ea6] Daily update.
$

...