我试图在GitHub上审查一个拉请求到一个不是主的分支。目标分支在master后面,拉请求显示了来自master的提交,所以我合并了master并将其推送到GitHub,但刷新后,他们的提交和差异仍然出现在拉请求中。我已经再次检查了GitHub上的分支是否有来自master的提交。为什么它们仍然出现在拉请求中?
我还检查了本地拉请求,它只显示未合并的提交。
我试图在GitHub上审查一个拉请求到一个不是主的分支。目标分支在master后面,拉请求显示了来自master的提交,所以我合并了master并将其推送到GitHub,但刷新后,他们的提交和差异仍然出现在拉请求中。我已经再次检查了GitHub上的分支是否有来自master的提交。为什么它们仍然出现在拉请求中?
我还检查了本地拉请求,它只显示未合并的提交。
我知道大o符号,但我不知道如何计算它的许多函数。特别是,我一直在试图弄清楚朴素版斐波那契数列的计算复杂度:
int Fibonacci(int n)
{
if (n <= 1)
return n;
else
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
斐波那契数列的计算复杂度是多少?它是如何计算的?
我对Github相当陌生,遇到了一个业余的问题。
我被要求做一个代码审查,并提供了一个提交哈希,但是我试着在Git中寻找,如果我可以使用提交哈希进行搜索,但找不到任何东西。
是否有一种方法,我可以通过使用提交哈希找到更改的代码?
I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been looking and playing for a long time, trying to figure out how to remove the commits that contain the edits to those files, it seems to be a toss up between revert and rebase, and there are no straightforward examples, and the docs assume I know more than I do.
下面是这个问题的简化版本:
给定下面的场景,我如何删除提交2?
$ mkdir git_revert_test && cd git_revert_test
$ git init
Initialized empty Git repository in /Users/josh/deleteme/git_revert_test/.git/
$ echo "line 1" > myfile
$ git add -A
$ git commit -m "commit 1"
[master (root-commit) 8230fa3] commit 1
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 myfile
$ echo "line 2" >> myfile
$ git commit -am "commit 2"
[master 342f9bb] commit 2
1 files changed, 1 insertions(+), 0 deletions(-)
$ echo "line 3" >> myfile
$ git commit -am "commit 3"
[master 1bcb872] commit 3
1 files changed, 1 insertions(+), 0 deletions(-)
预期的结果是
$ cat myfile
line 1
line 3
以下是我一直试图恢复的一个例子
$ git revert 342f9bb
Automatic revert failed. After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
and commit the result.
这句话的语境是:
master在X quickfix1在X + 2次提交时
这样:
o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
然后我开始开发quickfix2,但意外地把quickfix1作为要复制的源分支,而不是主分支。现在quickfix2是X + 2个提交+ 2个相关提交。
o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
\
q2a--q2b (quickfix2 HEAD)
现在我想要一个带有quickfix2的分支,但不包含属于quickfix1的2个提交。
q2a'--q2b' (quickfix2 HEAD)
/
o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
我尝试从quickfix2中的某个修订中创建一个补丁,但补丁不保存提交历史。是否有一种方法可以保存我的提交历史,但在quickfix1中有一个没有更改的分支?
我想要在所有分支上获得每个作者的提交数。我明白了
git shortlog -s -n
打印一个非常好的列表,但它没有计算尚未从其他分支合并的提交。如果在每个分支上迭代此命令,那么显然公共提交将被计数多次。你能给我一个脚本/命令,让我了解总体情况吗?
是否有可能看到谁在git blame报告的提交之前编辑了特定的行,就像一个给定行的提交历史?
例如,我运行以下(在优秀的uncrustify项目上):
$ git blame -L10,+1 src/options.cpp
^fe25b6d (Ben Gardner 2009-10-17 13:13:55 -0500 10) #include "prototypes.h"
我如何才能找到谁在提交fe25b6d之前编辑了这一行?在提交之前是谁编辑的?
我如何用真正的编辑器显示的新行替换Sublime文本中的\n:
foo\nbar
就变成:
foo
bar
在编辑器中查看文件。
在终端中使用。subl
它返回-bash: .subl:命令未找到
有人知道如何在macOS的命令行打开Sublime Text 3吗?
是否有一种方法可以在Subversion中编辑某个修订的日志消息?我不小心在我的提交消息中写了错误的文件名,这可能会让人困惑。
我已经看到如何在Git中编辑错误的提交消息?,但这个问题的解决方案似乎与Subversion不同(根据svn help commit)。