Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have checked out a remote repo. Now I did some operations of adding some file to the repo. as well as (perhaps) removing some files in the repo. In both the instances git was not informed of the changes. Is there a way for git to check the integrity of the repo. and inform me whatever files were changed (or not) ?

I saw this post 1 but dunno if that covers the scenario I shared above. Is $git fsck enough? If I remove a file from the local repo. how would git tell/show it ?

Look forward to answers.

share|improve this question
    
Look at the logs on the two repositories? Can you elaborate more on what you are confused about? –  Zoredache Sep 6 '13 at 23:18
    
@Zoredache thank you for answering. I edited my post but to be crystal clear, what if I have removed or added files after doing a $git pull origin master . In such a case the git logs would be identical (I guess). Just to test it I added a few files to the git repo. and did try $git fsck . It didn't get or even tell me that those files are not part of the repo. This is what the output $git fsck shows :- –  shirish Sep 6 '13 at 23:34
    
$ git fsck Checking object directories: 100% (256/256), done. Checking objects: 100% (1974/1974), done. As can be seen it didn't tell me that some files have been added to the repo. which are untracked (i.e. git knows nothing about them as I haven't used $git-add . Similarly if a file is deleted I dunno if git fsck would work it out or not. If anybody has any ideas please share. –  shirish Sep 6 '13 at 23:41
    
What do you mean by removing files? Do you mean changing things in the .git folder? Or your working tree? If you changed things in your working tree, then use git status. If you have made local commits, then git log will show the commits, and with the right options can give you a list of files or the full patch. –  Zoredache Sep 6 '13 at 23:41
    
ah thanx, git status is what I was looking for. It did tell me that couple of files and directories which are untracked. Would it also tell/share with me if files are deleted in a similar way ? Another query how do I close this question? I don't see a way of closing a question once it has been answered. Thank you again @Zoredache –  shirish Sep 6 '13 at 23:45

1 Answer 1

up vote 2 down vote accepted

You seem to be looking for the git status command.

From man git-status

Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by git (and are not ignored by gitignore(5)). The first are what you would commit by running git commit; the second and third are what you could commit by running git add before running git commit.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.