git:与远程同步本地回购 [英] git: sync local repo with remote one
问题描述
我有本地&远程git存储库。我想将本地存储库与远程存储库同步,以便我的本地存储库成为远程存储库的100%副本。这意味着如果这些回购中的某些文件不同,我们会用远程文件覆盖本地文件。如果在本地回购协议中存在远程回购中不存在的文件,则会删除本地文件。
I have local & remote git repositories. I want to sync my local repository with remote repository so that my local repository becomes 100% copy of remote repository. Meaning that if certain files differ in these repos we override local ones with remote ones. And if there are files in local repos that do not exist in remote repo, local files get removed.
有没有一种方法可以实现这一点,远程回购?
Is there a way to achieve that other than doing a fresh clone of remote repo?
类似的问题为。
Similar question as Sync local git repo with remote in one shot discarding local changes/commits.
推荐答案
git fetch --prune
-p,--prune
取出后,移除遥控器上不再存在的所有远程追踪分支。 修剪选项
这篇关于git:与远程同步本地回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!