Questions tagged [git-status]

Shows which files in a Git repository have been modified and/or staged and what state they are in since the last commit

This is the main tool in to see the status of the files on the stage and what state they are in.

Running this command will tell you what tracked files have been added, deleted or modified since the last commit.

On a fresh repo or branch, you should see the following:

$ git status
# On branch master
nothing to commit (working directory clean)

See also

References

170 questions
363
votes
9 answers

Git: list only "untracked" files (also, custom commands)

Is there a way to use a command like git ls-files to show only untracked files? The reason I'm asking is because I use the following command to process all deleted files: git ls-files -d | xargs git rm I'd like something similar for untracked…
We Are All Monica
  • 11,597
  • 7
  • 41
  • 69
235
votes
24 answers

git status shows modifications, git checkout -- doesn't remove them

I would like to remove all changes to my working copy. Running git status shows files modified. Nothing I do seems to remove these modifications. E.g.: rbellamy@PROMETHEUS /d/Development/rhino-etl (master) $ git status # On branch master # Changed…
rbellamy
  • 5,276
  • 6
  • 34
  • 45
201
votes
9 answers

How to check if there's nothing to be committed in the current branch?

The goal is to get an unambiguous status that can be evaluated in a shell command. I tried git status but it always returns 0, even if there are items to commit. git status echo $? #this is always 0 I have an idea but I think it is rather a bad…
9nix00
  • 3,162
  • 2
  • 18
  • 25
138
votes
2 answers

Git list of staged files

I staged a lot of files using git add, now I want to see all the files I have staged, without untracked files or changed but unstaged files. How do I do that? When using git diff --cached I can see the changes of what I just staged. So then I tried…
Timon de Groot
  • 4,658
  • 4
  • 19
  • 36
109
votes
13 answers

"fatal: Not a git repository (or any of the parent directories)" from git status

This command works to get the files and compile them: git clone a-valid-git-url for example: git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/liggghts However, git status (or any other git command) then gives the above fatal: Not a git…
Kevin Kostlan
  • 2,817
  • 6
  • 25
  • 32
97
votes
1 answer

How to colorize git-status output?

I want to colorize git-status output so that: untracked files = magenta new files = green modified files = blue deleted files = red I am instead seeing staged files in green and unstaged files in blue: My .gitconfig is setup with the following…
Andy
  • 1,984
  • 2
  • 19
  • 16
91
votes
2 answers

How to resolve git status "Unmerged paths:"?

I merged branch dog into animal. When I go to commit, I get the following: Unmerged paths: (use "git reset HEAD ..." to unstage) (use "git add ..." to mark resolution both deleted: ../public/images/originals/dog.ai added by them: …
keruilin
  • 14,638
  • 30
  • 103
  • 172
90
votes
5 answers

How to make git status show only staged files

I would like to get a list of only the staged filenames. I can't find the equivalent flag for --name-only for the git status command. What is a good alternative? The file list will be piped to php -l (PHP lint syntax checker). Solution: the complete…
Ward Bekker
  • 5,926
  • 8
  • 35
  • 60
79
votes
4 answers

Git refuses to reset/discard files

I have a project with certain js files which I cannot update. I run OSX locally and my remote/staging server is Linux (CentOS). Right after cloning my project locally, i noticed I have all those files with git status modified. I never modified them,…
mgPePe
  • 5,205
  • 12
  • 46
  • 78
50
votes
3 answers

git: Why doesn't git diff show any differences?

If I run 'git status' on my repo it gives: # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: myfile However, if I do a 'git diff myfile' it shows no differences. Is this because I have…
Noam
  • 2,945
  • 3
  • 16
  • 8
48
votes
3 answers

Is there a way to tell git-status to ignore the effects of .gitignore files?

I have configured numerous .gitignore files to filter out many different unwanted files from a set of about 6,000 untracked files. I want to do git add . when I've got my filtered list looking the way I want it. But, then I want to disable the…
davidA
  • 10,282
  • 8
  • 54
  • 76
45
votes
10 answers

git: programmatically know by how much the branch is ahead/behind a remote branch

I would like to extract the information that is printed after a git status, which looks like: # On branch master # Your branch is ahead of 'origin/master' by 2 commits. Of course I can parse the output of git status but this is not recommended…
Olivier Verdier
  • 41,410
  • 26
  • 94
  • 89
42
votes
4 answers

How can I tell which remote "parent" branch my branch is based on?

I have a scenario in which there a several remote tracking branches within my local repository that I must sync up to. Our workflow model is: make a branch locally, based off of the desired remote tracking branch make our…
Andrew Falanga
  • 421
  • 1
  • 4
  • 3
41
votes
3 answers

How can I get content of a file from git index?

I have a file which has been already added to my local repository. I've modified it in the working tree, so git status shows me the file as modified. I would like to know what is the file content kept in the index before I stage the file. I can…
zaza
  • 1,169
  • 2
  • 10
  • 21
37
votes
6 answers

git status shows modifications even with autocrlf=false

I'm experiencing the same issues as in this question: git status shows modifications, git checkout -- doesn't remove them Git continues to show working directory modifications, even with git config --global core.autocrlf…
codekaizen
  • 25,796
  • 7
  • 81
  • 132
1
2 3
11 12