您尚未完成合并(MERGE_HEAD存在)

时间:2012-07-25 08:58:18

标签: git

我做了一个名为'f'的分支并做了一个结账来掌握。当我尝试git pull命令时,我收到了这条消息:

You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.

当我尝试git status时,它给了我以下内容:

On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 13 different commit(s) each, respectively.
#
# Changes to be committed:
#
#   modified:   app/assets/images/backward.png
#   modified:   app/assets/images/forward.png
#   new file:   app/assets/images/index_background.jpg
#   new file:   app/assets/images/loading.gif
#   modified:   app/assets/images/pause.png
#   modified:   app/assets/images/play.png
#   new file:   app/assets/javascripts/jquery-ui-bootstrap.js
#   new file:   app/assets/stylesheets/jquery-ui-bootstrap.css
#   modified:   app/controllers/friends_controller.rb
#   modified:   app/controllers/plays_controller.rb
#   modified:   app/mailers/invite_friends_mailer.rb
#   modified:   app/mailers/send_plays_mailer.rb
#   modified:   app/mailers/shot_chart_mailer.rb
#   modified:   app/views/friends/show_plays.html.erb
#   modified:   app/views/layouts/application.html.erb
#   modified:   app/views/plays/_inbox_table.html.erb
#   modified:   app/views/plays/show.html.erb
#   modified:   app/views/welcome/contact_form.html.erb
#   modified:   app/views/welcome/index.html.erb
#   modified:   log/development.log
#   modified:   log/restclient.log
#   new file:   tmp/cache/assets/C1A/C00/sprockets%2Fb7901e0813446f810e560158a1a97066
#   modified:   tmp/cache/assets/C64/930/sprockets%2F65aa1510292214f4fd1342280d521e4c
#   new file:   tmp/cache/assets/C73/C40/sprockets%2F96912377b93498914dd04bc69fa98585
#   new file:   tmp/cache/assets/CA9/090/sprockets%2Fa71992733a432421e67e03ff1bd441d8
#   new file:   tmp/cache/assets/CCD/7E0/sprockets%2F47125c2ebd0e8b29b6511b7b961152a1
#   modified:   tmp/cache/assets/CD5/DD0/sprockets%2F59d317902de6e0f68689899259caff26
#   modified:   tmp/cache/assets/CE3/080/sprockets%2F5c3b516e854760f14eda2395c4ff2581
#   new file:   tmp/cache/assets/CED/B20/sprockets%2F423772fde44ab6f6f861639ee71444c4
#   new file:   tmp/cache/assets/D0C/E10/sprockets%2F8d1f4b30c6be13017565fe1b697156ce
#   new file:   tmp/cache/assets/D12/290/sprockets%2F93ae21f3cdd5e24444ae4651913fd875
#   new file:   tmp/cache/assets/D13/FC0/sprockets%2F57aad34b9d3c9e225205237dac9b1999
#   new file:   tmp/cache/assets/D1D/DE0/sprockets%2F5840ff4283f6545f472be8e10ce67bb8
#   new file:   tmp/cache/assets/D23/BD0/sprockets%2F439d5dedcc8c54560881edb9f0456819
#   new file:   tmp/cache/assets/D24/570/sprockets%2Fb449db428fc674796e18b7a419924afe
#   new file:   tmp/cache/assets/D28/480/sprockets%2F9aeec798a04544e478806ffe57e66a51
#   new file:   tmp/cache/assets/D3A/ED0/sprockets%2Fcd959cbf710b366c145747eb3c062bb4
#   new file:   tmp/cache/assets/D3C/060/sprockets%2F363ac7c9208d3bb5d7047f11c159d7ce
#   new file:   tmp/cache/assets/D48/D00/sprockets%2Fe23c97b8996e7b5567a3080c285aaccb
#   new file:   tmp/cache/assets/D6A/900/sprockets%2Fa5cece9476b21aa4d5f46911ca96c450
#   new file:   tmp/cache/assets/D6C/510/sprockets%2Fb086a020de3c258cb1c67dfc9c67d546
#   new file:   tmp/cache/assets/D70/F30/sprockets%2Facf9a6348722adf1ee7abbb695603078
#   new file:   tmp/cache/assets/DA3/4A0/sprockets%2F69c26d0a9ca8ce383e20897cefe05aa4
#   new file:   tmp/cache/assets/DA7/2F0/sprockets%2F61da396fb86c5ecd844a2d83ac759b4b
#   new file:   tmp/cache/assets/DB9/C80/sprockets%2F876fbfb9685b2b8ea476fa3c67ae498b
#   new file:   tmp/cache/assets/DBD/7A0/sprockets%2F3640ea84a1dfaf6f91a01d1d6fbe223d
#   new file:   tmp/cache/assets/DC1/8D0/sprockets%2Fe5ee1f1cfba2144ec00b1dcd6773e691
#   new file:   tmp/cache/assets/DCC/E60/sprockets%2Fd6a95f601456c93ff9a1bb70dea3dfc0
#   new file:   tmp/cache/assets/DF1/130/sprockets%2Fcda4825bb42c91e2d1f1ea7b2b958bda
#   new file:   tmp/cache/assets/E23/DE0/sprockets%2Fb1acc25c28cd1fabafbec99d169163d3
#   new file:   tmp/cache/assets/E23/FD0/sprockets%2Fea3dbcd1f341008ef8be67b1ccc5a9c5
#   modified:   tmp/cache/assets/E4E/AD0/sprockets%2Fb930f45cfe7c6a8d0efcada3013cc4bc
#   new file:   tmp/cache/assets/E63/7D0/sprockets%2F77de495a665c3ebcb47befecd07baae6
#   modified:   tmp/pids/server.pid
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   Coachbase/
#   log/development.log.orig
#   log/restclient.log.orig

我该怎么办?

16 个答案:

答案 0 :(得分:1527)

行。问题是你之前的拉动无法自动合并并进入冲突状态。在下次拉动之前,冲突没有得到妥善解决。

  1. 撤消合并并再次拉动。

    撤消合并:

    git merge --abort [自git版本1.7.4]

    git reset --merge [先前的git版本]

  2. 解决冲突。

  3. 不要忘记添加并提交合并。

  4. git pull现在应该可以正常使用。

答案 1 :(得分:74)

如果您确定已经解决了所有合并冲突:

rm -rf .git/MERGE*

错误将消失。

答案 2 :(得分:57)

我认为值得一提的是,有许多情况可能会发生消息You have not concluded your merge (MERGE_HEAD exists),因为很多人在搜索了所述消息后可能已到达此页面。决议将取决于你如何到达那里。

git status始终是一个有用的起点。

如果您已经将内容合并到您满意的程度并且仍然收到此消息,那么它可能就像执行

一样简单
git add file
git commit

但是,这又取决于具体情况。在尝试任何事情之前理解基础知识是个好主意(Terence发布的相同链接): Git - Basic Merge Conflicts

答案 3 :(得分:5)

我已解决冲突并已提交但仍在git push

上收到此错误消息
  

所有冲突都已修复,但您仍在合并中   (使用&#34; git commit&#34;结束合并)

我做了以下步骤来解决错误:

rm -rf .git/MERGE*
git pull origin branch_name 
git push origin branch_name

答案 4 :(得分:5)

我认为这是正确的方法:

git merge --abort

git fetch --all

然后,您有两个选择:

git reset --hard origin/master

或者如果您在其他分支机构上:

git reset --hard origin/<branch_name>

答案 5 :(得分:5)

中止对我不起作用。所以我不得不continue,这对我有用:

git merge --continue

答案 6 :(得分:4)

尝试更改任何临时文件。就像删除任何空间或添加空间然后提交并推送该文件一样。

  

git add'temporary_change_file'

     

git commit -m“git issue resolving”

     

git push origin develop

然后尝试git pull,

  

git pull origin develop

希望这对你有所帮助。

答案 7 :(得分:2)

在我的情况下,我有一个樱桃选择产生了一些合并冲突,所以我决定不完成樱桃选择。我放弃了所有的改变。这样做会让我进入一个我收到以下错误的状态:

  

您尚未完成合并(MERGE_HEAD存在

为了解决这个问题,我执行了以下git命令来修复问题。

git cherry-pick --abort

答案 8 :(得分:2)

Blockquote

如果您试图从另一个分支拉入您的分支。如果您看到此错误。

首先,您应该尝试执行git commit,然后将另一个分支拉入您的分支。

  1. “ git add”。
  2. git commit
  3. 然后从所需分支执行git pull。

答案 9 :(得分:2)

我们可以将git merge --continue与git 2.12及更高版本一起使用,以解决冲突后继续进行合并。可以看到此answer

答案 10 :(得分:1)

最佳方法是撤消合并并再次执行合并。通常你会弄清楚事情的顺序。尝试并解决冲突,让自己陷入困境。

所以撤消它并再次合并。

确保为您的环境设置了适当的diff工具。我在Mac上并使用DIFFMERGE。我认为DIFFMERGE适用于所有环境。说明在这里:Install DIFF Merge on a MAC

我有助于解决我的冲突:Git Basic-Merge-Conflicts

答案 11 :(得分:1)

尝试

git reset --hard origin/trunk

“ trunk”是我要到达的分支。

我不知道它如何或为什么起作用。它与我所做的某些提交有关,这迫使我的请求请求进行合并。

答案 12 :(得分:1)

提交合并更改解决了我的问题:

git commit -m "commit message"

答案 13 :(得分:0)

首先,使用(18, 4) x_train shape = (None, 600, 750, 1) # grayscale y_train shape = (None, 18, 4) 合并存储库以保存您的更改。然后重新输入model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(32, kernel_size=(3, 3), input_shape=(h, w, 1), strides=(2, 2), padding="same", activation="relu"), tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=(2, 2), padding="same"), tf.keras.layers.Dropout(0.25), tf.keras.layers.Conv2D(64, (3, 3), strides=(2, 2), padding="same", activation="relu"), tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=(2, 2), padding="same"), tf.keras.layers.Dropout(0.25), tf.keras.layers.Conv2D(128, (3, 3), strides=(2, 2), padding="same", activation="relu"), tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=(2, 2), padding="same"), tf.keras.layers.Dropout(0.25), tf.keras.layers.Conv2D(512, (3, 3), strides=(2, 2), padding="same", activation="relu"), tf.keras.layers.MaxPooling2D(pool_size=(2, 2), strides=(2, 2), padding="same"), tf.keras.layers.Dropout(0.25), tf.keras.layers.Flatten(), tf.keras.layers.Dense(1024, activation="relu"), tf.keras.layers.Dropout(0.5), tf.keras.layers.Dense(18) ]) model.compile(loss="mse", optimizer=tf.keras.optimizers.RMSprop(), metrics=["accuracy"]) model.fit(x_train, y_train, epochs=1) model.save("trained_model.h5")

答案 14 :(得分:0)

我解决了冲突,然后使用-a选项进行了提交。 它对我有用。

答案 15 :(得分:-12)

这对我有用:

 unsigned count_norvegian_lowercase_vowels(const char*s) {
   assert (s != NULL);
  // s should be a not-too-big string 
  // (its `strlen` should be less than UINT_MAX)
  // s is assumed to be UTF-8 encoded, and should be valid UTF-8:
    if (!g_utf8_validate(s, -1, NULL)) {
      fprintf(stderr, "invalid UTF-8 string %s\n", s);
      exit(EXIT_FAILURE);
    };
    unsigned count = 0;
    char* next= NULL; 
    char* pc= NULL;
    for (pc = s; *pc != '\0' && ((next=g_utf8_next_char(pc)), *pc); pc=next) {
      g_unichar u = g_utf8_get_char(pc);
      // comments from OP make me believe these are the only Norvegian vowels.
      if (u=='a' || u=='e' || u=='i' || u=='o' || u=='u' || u=='y'
          || u==(g_unichar)0xa6 //æ U+00E6 LATIN SMALL LETTER AE
          || u==(g_unichar)0xf8  //ø U+00F8 LATIN SMALL LETTER O WITH STROKE
          || u==(g_unichar)0xe5 //å U+00E5 LATIN SMALL LETTER A WITH RING ABOVE
       /* notice that for me  ы & ê are also vowels but œ is a ligature ... */
      )
        count++;
    };
    return count;
  }