git github在使用pull命令时锁定mac终端
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14046122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
github locks up mac terminal when using pull command
提问by zero
I'm in the process of learning github on mac (command-line) and whenever I do git pull origin master
i get this
我正在 mac(命令行)上学习 github,无论何时我都会git pull origin master
得到这个
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
".git/MERGE_MSG" 7L, 293C
the terminal seems to lock up and doesn't allow me to enter anything immediately, then when it finally does allow me to enter text it seems like it doesn't recognize git commands.
终端似乎锁定并且不允许我立即输入任何内容,然后当它最终允许我输入文本时,它似乎无法识别 git 命令。
Is this a bug in git or am i missing something?
这是 git 中的错误还是我遗漏了什么?
回答by ceyko
You're in the text editor, vim! It's a modaltext editor, so you would need to:
你在文本编辑器中,vim!这是一个模态文本编辑器,因此您需要:
- Press ito enter insert mode.
- Now you can type your message, as if you were in a normal (non-modal) text editor.
- Press escto go back to command mode.
- Then type
:w
followed by enterto save. - Finally
:q
followed by enterto quit.
- 按i进入插入模式。
- 现在您可以键入您的消息,就像您在普通(非模态)文本编辑器中一样。
- 按esc返回命令模式。
- 然后输入
:w
并enter保存。 - 最后
:q
跟着enter退出。
回答by abbas
Make it simple.
让它变得简单。
Type :wq
and enter
类型:wq
和enter
回答by OM Bharatiya
The editor looks like to be vimaccording to your descriptions. This console is simply telling you to write some message for the commit you want to make, and it is compulsory as it does.
根据您的描述,编辑器看起来像是vim。这个控制台只是告诉你为你想要提交的提交写一些消息,它是强制性的。
Just type
i
and you'll go in the-- INTER --
mode, now you can write your comments.After you have done writing, press
esc
key in your keyboard and you'll go to command mode. (see on the bottom of the console)Now save changes by writing
:w
followed by pressingenter
key
只需输入
i
即可进入-- INTER --
模式,现在您可以写下您的评论。写完后,按
esc
键盘上的键,您将进入命令模式。(见控制台底部)现在通过写入
:w
然后按enter
键来保存更改
- You can quit now by writing
:q
followed by pressingenter
key
- 您现在可以通过写入
:q
然后按enter
键退出
- Hurray! Finally you're back to the main console.
- 欢呼!最后,您将返回主控制台。
回答by Ariel Ruiz
More simple is first ESC and then :x(lowercase).
更简单的是先ESC 然后:x(小写)。
回答by Ayman Elshehawy
Run this command
运行这个命令
git config --global core.editor "gedit"
Add your message in this file and save it. Go back pull now.
在此文件中添加您的消息并保存。现在回去拉。
回答by Lukasz Dynowski
I fixed this problem by executing following steps
我通过执行以下步骤解决了这个问题
Remove #MERGE_MSG#
rm .git/\#MERGE_MSG#
Remove MERGE_HEAD
rm .git/MERGE_HEAD
删除#MERGE_MSG#
rm .git/\#MERGE_MSG#
删除MERGE_HEAD
rm .git/MERGE_HEAD
Additionally, I explicitly set git's editor to an editor that I am familiar with vim(you can set nano)
此外,我明确地将 git 的编辑器设置为我熟悉vim的编辑器(您可以设置nano)
`git config --global core.editor "vim"`
回答by mdeora
You can do
git checkout --merge yourbranch
你可以做
git checkout --merge yourbranch
A three-way merge between the current branch, your working tree contents, and the new branch is done, and you will be on the new branch.
当前分支、您的工作树内容和新分支之间的三向合并已完成,您将在新分支上。
回答by Erik Rybalkin
Problems usually happen when we misspell something.
It is more likely this command you are interested in:
当我们拼错某些东西时,通常会出现问题。
您更有可能对此命令感兴趣:
git commit -m "message"
if there was a problem, it might say something like
如果有问题,它可能会说类似
Your branch and 'origin/master' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
and use:
并使用:
git pull
which should lead to:
这应该导致:
Already up-to-date.
Then it is good to check:
那么最好检查一下:
git status
and try pushing again:
并再次尝试推送:
git push