- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在我的本地分支上有 1 个提交,然后将更改从远程分支带到我的本地,我在我的本地分支上做了一个 git pull
令我惊讶的是 git
说了这个。
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
我知道我在 vi
编辑器中。
我的问题是为什么 git 要求我输入消息。我以前从未遇到过。
我的 git 版本是:version 1.9.5-preview20141217
我提到了 this问题,但我仍然觉得很难理解。谢谢。
最佳答案
来自 Git Documentation :
Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD
关于您的问题:为什么
git pull
的默认行为。网上有很多关于这种行为的解释,this很好地解释了它。如何避免这种情况:
由于您的本地存储库提前 1 次提交,git 会尝试将您的远程存储库 merge 到您的本地存储库。这可以通过 merge 来处理,但在你的情况下,也许你正在寻找 rebase ,即将你的提交添加到顶部。你可以用
git rebase
或 git pull --rebase
如果这确实是您正在寻找的行为,您可以设置您的 git 配置,使 rebase 成为您的 git pull
全局设置:
git config branch.autosetuprebase always # Force all new branches to automatically use rebase
或者您可以按分支设置它:
git config branch.*branch-name*.rebase true # Force existing branches to use rebase.
关于git - 为什么 git 要求输入提交信息来解释为什么这个 merge 是必要的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36418708/
我正在使用 this solution在二进制矩阵中找到与图像边界对齐的矩形。假设现在我想找到一个不与图像边框对齐的矩形,并且我不知道它的方向;找到它的最快方法是什么? 为了示例,让我们寻找一个仅包含
else: 行在这个 Python 程序中是否正确/必要? from random import randrange for n in range(10): r = randrange(0,1
在 TDPL 7.1.5.1 中讨论了将 Widget w2 分配给 w1 并且作者指出“将 w2 逐个字段分配给 w1 会将 w2.array 分配给 w1.array——一个简单的数组边界分配,而
我是一名优秀的程序员,十分优秀!