Re: How can I tell if a file has been updated upstream?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Timur Tabi <timur@xxxxxxxxxxxxx> wrote:
> Is there a way for me to tell if a particular file in my repository
> has an update in the upstream repository?  For example, the SHA of the
> HEAD is different in the remote repository than it is of the HEAD in
> the local repository.
> 
> The reason I ask is that I have a set of Python scripts that I
> distribute via git (other people in the company clone my repository).
> I want my script, every time it's run, to check if an update is
> available, and ask the user to do "git pull".

You can't tell a particular file, but you could use something like
`git ls-remote refs/heads/master` to see what the branch is at,
and compare that to the last known commit.  If its changed, then
suggest the user do a fetch.

I do this in repo, only I run `git fetch` once per day for the
end-user.  That way the objects are local, and I can use a local
check to see if there are updates that need to be pulled into the
executable working directory.

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]