Check if specific file in git repository has changed

前端 未结 4 813
面向向阳花
面向向阳花 2021-02-05 03:59

I am novice in dealing with git, but I have a repository that contains a file named \'test\'. I want to check if that specific file has changed. Is there anyway to do that?

4条回答
  •  囚心锁ツ
    2021-02-05 04:53

    Git doesn't provide methods to query history of a remote repository. Git commands are intended to be run against a local repository, so you would have to clone first (fetch would be cheaper if you've cloned once before). That said, there are some ways to get around this limitation:

    • You could ask your Git server to run the commands you want for you via some kind of API. For example, browsing GitHub webpages or using their developer API fall into this category. In this case, GitHub's web servers are running Git commands for you. If you're using a server other than bare Git, check to see if your server has an API that could help.
    • Use git-archive to download an archive containing parts of the repository. I don't think this will help you.

提交回复
热议问题