git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to check repository/working tree status from a script
@ 2009-05-19 14:35 Marc Haber
  2009-05-19 15:34 ` Tony Finch
  2009-05-21 13:24 ` Marc Haber
  0 siblings, 2 replies; 15+ messages in thread
From: Marc Haber @ 2009-05-19 14:35 UTC (permalink / raw)
  To: git

Hi,

I am kind of new to git, and my thinking is still somewhat
svn-centric. Please keep this in mind just in case that I have
misunderstood some of git's concepts.

I would like to check in a script whether there (a) are uncommitted
changes (as in "working tree differs from local repository") and/or
whether there (b) are unpulled changes in the "remote origin"
repository.

I have to admit that I didn't bother about (b) yet, but for (a) there
seems no possibility other than to parse git status' output since it
seems to always return exit code 1:

$ GIT_PAGER=cat git status; echo $?
# On branch master
nothing to commit (working directory clean)
1
$ touch keks
$ GIT_PAGER=cat git status; echo $?
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       bla
nothing added to commit but untracked files present (use "git add" to
track)
1
$

Am I missing something here? Is there documentation about the exit
codes of the different git subcommands or probably a complete solution
for my two endeavours?

Any hints will be appreciated.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-05-23 20:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 14:35 How to check repository/working tree status from a script Marc Haber
2009-05-19 15:34 ` Tony Finch
2009-05-19 16:00   ` Marc Haber
2009-05-19 16:16     ` Tony Finch
2009-05-20 14:28       ` Marc Haber
2009-05-19 16:18     ` Linus Torvalds
2009-05-19 16:29       ` Linus Torvalds
2009-05-20 14:27         ` Marc Haber
2009-05-20 11:10       ` Marc Haber
2009-05-20 11:19         ` Santi Béjar
2009-05-20 11:32         ` Johannes Sixt
2009-05-20 14:29           ` Marc Haber
2009-05-21 13:24 ` Marc Haber
2009-05-21 15:37   ` Jeff King
2009-05-23 20:39     ` Marc Haber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).