更新时间:2023-02-14 21:40:17
A git pull
does a fetch
followed by a merge
, and you can't merge without a working tree. (There would be nowhere to resolve merge conflicts if they should arise.)
Instead, you could just fetch. Assuming your main repository is configured as a remote called origin on your personal repository:
$ git fetch origin master:master
Note that this will only be successful if the master branch of your personal repository is mirroring the master branch of the main repository. Otherwise, Git will reject the non-fast-forward fetch.