GitHub同步一个分叉错误

时间:2016-07-19 22:52:20

标签: git github

当我尝试通过终端上游同步一个分支时,它向我展示了一些奇怪的结果。有人遇到过这个问题吗?请指导我做什么。

  1. 当我第二次尝试执行命令git merge upstream / master时,会显示此图像。
  2. 当我第一次执行命令git merge upstream / master并且无法摆脱它时,会出现此窗口
  3. 当我尝试写一些东西来保存但没有任何事情发生时
  4. 最后必须使用control + Z来停止它,但几乎不能正常工作
  5. This Image shows up when I am trying to execute the command git merge upstream/master the second time

    This window shows up when i execute the command git merge upstream/master for the first time and cant get rid of it

    When I try and write something in it to save but nothing happens still

    Finally have to stop it using control + Z but hardly works

3 个答案:

答案 0 :(得分:0)

使用以下键保存:

  1. ESC
  2. qq的
  3. 输入

答案 1 :(得分:0)

这与git无关,而是与vi有关。您正在使用的默认编辑器vi从未退出(ctrl-Z只是暂停它),其交换文件仍然存在。再次启动时,它会检测到这一点,并询问您该怎么做。只需按照说明(可能 R 进行恢复)并正常进行。要在结束时退出,请不要使用 ctrl + Z 。使用 Z Z w q

您还应该考虑将编辑器更改为您更熟悉的编辑器。为此,请使用git config --global core.editor,然后使用首选编辑器的可执行文件。

git config --global core.editor nano

答案 2 :(得分:0)

在将fork与上游存储库同步之前,必须配置一个指向Git中上游存储库的遥控器。

    1. Open Terminal.
    2. Change the current working directory to your local project.
    3. Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master
    4. If you don't care about applying also the eventual commits that have been added between the origin and the pull request, you can just rebase the branch on which the pull request was formed

Example: 

    $ git remote add upstream git://github.com/request-author/project.git
    $ git fetch upstream
    $ git rebase master upstream/pullrequest-branch


Congratulations !!!!
相关问题