Philip, I think this is the solution that I was looking for.
I ran at "test" dry-run on a repo that I know was different from what I have on my local machine. It showed six changes, but since it was a dry-run, nothing was updated, as far as I know. However, when I ran it again a few moments later, it came back as if the local repo was up-to-date with the remote. My thoughts are a dry-run shouldn't update anything, but only show that there are changes that could be applied if I ran it without the dry-run enabled. Did something in fact get updated? Thanks Daryl On Thursday, June 28, 2018 at 3:27:29 PM UTC-5, Philip Oakley wrote: > > Hi Daryl, > > You may need a slight change of mind set. Git does not do things the way > other (older) SCMs do/did. > > Git status, in general, is all about your local repository, so if you > haven't done anything, it won't say anything. > > The other "remote" repository must be explicitly queried to find out about > differences. At this point, be very wary of most mentions of 'remotes', as > they are talking about your local copy of the remote, rather than what is > truly at that distant remote repository. > > One method is (as per https://stackoverflow.com/a/7939193/717355) > `git fetch --dry-run` The manual (git help fetch) says: > > --dry-run > Show what would be done, without making any changes. > > As an aside, I generally try to avoid `git pull` because it does both `git > fetch` (which you want) and `git merge` which may not be what you want. > > The fetch stores the distant repo in the local 'remote' and is just part > of > the 'branch' management, with nice naming conventions. > > regards > > Philip > > ----- Original Message ----- > From: <rose...@gmail.com <javascript:>> > To: "Git for human beings" <git-...@googlegroups.com <javascript:>> > Sent: Thursday, June 28, 2018 7:18 PM > Subject: [git-users] How to monitor a git repository for changes > > > > I'm new to git and just now learning how to use it and the commands. > > > > I've cloned some remote repositories to a local machine, and I would > like > > to be able to monitor those repositories for changes via a script. > > > > After some research, I thought that "git status" would report back the > > status of the repository and if there had been changes that need to be > > pulled to the local clone. However, after some testing, I can't get it > to > > work as I expected. I tested on some repo's that I know had recently > been > > changed, but "git status" always came back with "Your branch is > up-to-date > > with 'origin/master' ". Perhaps I don't know the correct way to use > git > > status, but I would think that I should get something back saying that > > there were changes, not that my branch was up-to-date. > > > > I've looked at some other suggestions that I found online, like "git > > ls-files", but nothing seems to provide the information that I need. > > > > How can I monitor a remote git repo for changes? > > > > Thanks > > > > Daryl > > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Git for human beings" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to git-users+...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > > > > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.