从远程git仓库更新本地git repo force。 (胖客户端部署) [英] Local git repo force updated from a remote git repo. (thick-client deployments)
问题描述
更新:我认为这与windows git client msysgit有关。对不起,麻烦你们。 http://code.google.com/p/msysgit/issues/detail?id=379&colspec=ID%20Type%20Status%20Priority%20Component%20Owner%20Summary
我正在寻找一种方法来保持多个客户端机箱与远程git仓库同步。强制从远程仓库进行更新,并放弃任何可能在客户端框中更改的内容。
我遇到的问题是客户端框会修改一些文件(安装日志等),并为我提供了一个合并噩梦,当我需要从远程仓库进行更新时。我已经尝试了几个命令来尝试重置其本地更改(本地更改应该被放弃),但似乎没有任何广告(git reset --hard)。
我不想做一个克隆,然后在这些盒子上删除.git目录,因为我更喜欢它们只更新更改,而不是每次都下拉整个回购。
任何想法?
我假设您有充分的理由使用Git这是,而不是rsync。
这就是我要做的(在客户端上):
git fetch origin
git reset --hard origin / master
git clean -dfx
请注意,您需要重置为 origin / master
而不是 HEAD
因为本地的 HEAD
不包含源的最新提交(还)。
Update: I think this is related to an issue with the windows git client msysgit. Sorry to trouble you guys. http://code.google.com/p/msysgit/issues/detail?id=379&colspec=ID%20Type%20Status%20Priority%20Component%20Owner%20Summary
I'm looking for a way to keep several client boxes in synch with a remote git repo. Forcing updates from the remote repo and abandoning anything that may have changed on the client boxes.
The problem I'm running into is that the client boxes will modify some of the files (installation logs etc.) and gives me a merge nightmare when I need to update them from the remote repo. I've tried several commands to try and reset their local changes (the local changes should just be abandoned), but none seem to be working as advertised (git reset --hard).
I don't want to do a clone and then delete the .git dir on these boxes as I'd prefer them to only update with changes rather than pulling down the entire repo every time.
Any ideas?
I'm assuming you have a good reason for using Git for this, rather than rsync.
This is how I'd do it (on the Clients):
git fetch origin
git reset --hard origin/master
git clean -dfx
Note that you need to reset to origin/master
rather than HEAD
because the local HEAD
doesn't include the origin's newest commits (yet).
这篇关于从远程git仓库更新本地git repo force。 (胖客户端部署)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!