我最近被添加为一个GitHub存储库的协作者。我的问题是如何将存储库的克隆与远程版本“链接”,以便使我的克隆与远程版本保持更新(因为其他人将对远程回购进行更改)。我一直在重新克隆远程存储库,但我认为有更好的方法可以做到这一点。顺便说一下,我正在使用VSCode。
如果你看不出来,我对协作/贡献是陌生的。
发布于 2020-11-08 06:40:50
当您保持本地git保持同步并将它们推送到您的叉时,您不需要保持您的叉子保持同步,这将自动发生。
# add remote as upstream
git remote add upstream https://github.com/whoever/whatever.git
# fetch changes made to upstream
git fetch upstream
# to update a branch rebase or merge the upstream
git checkout master
git rebase upstream/master
# keep your feature/PR up to date
git checkout feature
git rebase master
# this will also push the new commits on master to your fork
# you may need to use --force-with-lease if you pushed before
git push origin featurehttps://stackoverflow.com/questions/64734819
复制相似问题