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

197 questions
460
votes
10 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
  • 13,000
  • 8
  • 46
  • 72
321
votes
15 answers

Why doesn't Git ignore my specified file?

I added the following line to .gitignore: sites/default/settings.php but when I type git status it shows the file as unstaged file. What's the problem? All other patterns work well.
Nick.h
  • 4,035
  • 5
  • 21
  • 22
266
votes
11 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,852
  • 2
  • 21
  • 27
262
votes
14 answers

Why does 'git commit' not save my changes?

I did a git commit -m "message" like this: > git commit -m "save arezzo files" # On branch master # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes…
arezzo
  • 2,915
  • 2
  • 15
  • 14
258
votes
25 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,683
  • 6
  • 38
  • 48
237
votes
2 answers

Git list of staged files

I staged a lot of files using git add, and 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…
Timon de Groot
  • 7,255
  • 4
  • 23
  • 38
218
votes
18 answers

is it possible to `git status` only modified files?

Is it possible to have git status only show the modified files due, in my case, to having too many staged files?
chrisjlee
  • 21,691
  • 27
  • 82
  • 112
132
votes
14 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
  • 3,311
  • 7
  • 29
  • 33
119
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
  • 16,782
  • 34
  • 108
  • 175
115
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
  • 2,154
  • 3
  • 20
  • 16
107
votes
7 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
  • 6,316
  • 9
  • 38
  • 61
78
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,677
  • 12
  • 52
  • 85
61
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
  • 12,528
  • 9
  • 64
  • 96
58
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
  • 3,333
  • 3
  • 18
  • 8
47
votes
5 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
  • 471
  • 1
  • 4
  • 3
1
2 3
13 14