我刚刚开始使用git和github。 我从我的开发机器上检查了我的新应用程序。 在我的测试机器上,我已经有了代码的副本,但该副本是cp'd到它,并没有通过git。 保持测试机器代码与我的github更改同步的正确方法是什么?
答案 0 :(得分:1)
如果您在测试目录中有效检查了一些分支提示,但没有基础仓库,
git clone --no-checkout u://r/l ../wip # fetch just the repo, leave worktree as-is
mv ../wip/.git . # move the repo here
git symbolic-ref HEAD $thatbranch # set a refname for the worktree content
git read-tree HEAD # load the default worktree index from there
git update-index --refresh # get its metadata up to date
索引刷新会告诉您哪个工作树中的文件与索引所说的文件不匹配,并且您根本无法触及您的工作树,因此您可以进行泡沫冲洗重复直至找到什么提交最接近已经发布的内容。你甚至可以重新订购东西,
git read-tree $thatbranch
git update-index --refresh
只有当事实证明你已经加载了正确的或足够的
git symbolic-ref HEAD $thatbranch