Reverse a git fetch

前端 未结 4 485
盖世英雄少女心
盖世英雄少女心 2020-12-29 04:55

I have a thorough understanding of git, and the difference between pull, fetch, and merge. I have a remote that I track, fetch, and merge with occasionally, let say it\'s o

4条回答
  •  死守一世寂寞
    2020-12-29 05:16

    This isn't a "reverse a git fetch" answer, but it seems your actual problem is how to programmatically "watch a repo for changes" without necessarily altering your repository in any way.

    For this, you can use git fetch --dry-run. A dry run will not cause any changes to your repository, but if there are changes in the remote, then it will have some basic terminal output; if there are no changes there will not be any output. If you want to have this running as an automated script instead of a manual check, it should be relatively straightforward to create a simple bash script that tests git fetch --dry-run for output.

提交回复
热议问题