将文件夹移入和移出另一个桌面后发出Git问题

时间:2013-11-18 15:42:56

标签: git github push bitbucket

因此,凭借他们的无限智慧,我的工作已将所有内容转移到无法连接到互联网的安全服务器上,我不得不将项目移至服务器以通过虚拟桌面访问数据。

这当然会导致推送到Github的一些问题。

我曾希望我可以将我的git文件夹复制并粘贴到我的个人桌面上并间歇性地从那里提交/推送但是当我这样做时我似乎遇到了错误......似乎认为这些是在不同的回购中创建的?

$git commit -am 'Push new stuff'
$git push origin master

To https:xxxxxxxx.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https:xxxxxxxxxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
hint: to the same ref. You may want to first merge the remote changes (e.g.
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

关于如何让这个过程发挥作用的任何建议?

1 个答案:

答案 0 :(得分:0)

如果您的提交实际上比GitHub上的提交更进一步(虽然在此过程中有一些不同的分支),您可以将当前的工作移动到另一个分支,然后拉出GitHub上可用的内容,然后重新合并两个分支机构解决冲突。

git checkout master  // logical first step
git branch merger    // move current work to a merger branch
git pull origin      // update current branch to reflect GitHub repo
git merge merger     // merge with current work, resolving conflicts as needed
git commit origin    // push updated work back to GitHub