我是git的新手。
我的叉子: Fork @ https://github.com/bigopon/binding
主回购:Aurelia @ https://github.com/aurelia/binding
我的命令(按相同顺序执行):
git clone https://github.com/bigopon/binding.git
cd binding
git remote add upstream https://github.com/aurelia/binding.git
git fetch upstream
git rebase upstream/master
解决后我遇到了冲突:
git add *
git commit -m "Resolved"
我收到了这些消息:
您目前正在'36215e6'上修改分支'master'。 无需提交,工作目录清理
和
git push origin master
什么都不做
更新:以下是发生的事情:
C:\Users\Bigo\Desktop\aurelia-forks>git clone
https://github.com/bigopon/binding.git
Cloning into 'binding'...
remote: Counting objects: 4560, done.
remote: Total 4560 (delta 0), reused 0 (delta 0), pack-reused 4560R
Receiving objects: 100% (4560/4560), 4.52 MiB | 939.00 KiB/s, done.
Resolving deltas: 100% (3143/3143), done.
Checking connectivity... done.
C:\Users\Bigo\Desktop\aurelia-forks>cd binding
C:\Users\Bigo\Desktop\aurelia-forks\binding>git remote add upstream https://github.com/aurelia/binding.git
C:\Users\Bigo\Desktop\aurelia-forks\binding>git fetch upstream
remote: Counting objects: 99, done.
remote: Total 99 (delta 60), reused 60 (delta 60), pack-reused 39
Unpacking objects: 100% (99/99), done.
From https://github.com/aurelia/binding
* [new branch] master -> upstream/master
* [new tag] 1.2.1 -> 1.2.1
* [new tag] 1.1.1 -> 1.1.1
* [new tag] 1.2.0 -> 1.2.0
C:\Users\Bigo\Desktop\aurelia-forks\binding>git rebase upstream/master
First, rewinding head to replay your work on top of it...
Applying: Add self binding behavior section
Using index info to reconstruct a base tree...
M doc/article/en-US/binding-binding-behaviors.md
Falling back to patching base and 3-way merge...
Auto-merging doc/article/en-US/binding-binding-behaviors.md
CONFLICT (content): Merge conflict in doc/article/en-US/binding-binding-behaviors.md
Failed to merge in the changes.
Patch failed at 0001 Add self binding behavior section
The copy of the patch that failed is found in:
C:/Users/Bigo/Desktop/aurelia-forks/binding/.git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
C:\Users\Bigo\Desktop\aurelia-forks\binding>
我该怎么办?正如@ merlin2011在他的回答中所建议的那样,我不应该在rebase期间提交
答案 0 :(得分:2)
在git rebase
期间解决冲突后,接下来的步骤是添加然后继续rebase。您不应在rebase期间使用git commit
。相反,您应该在修复冲突后执行以下步骤。
# First fix conflicts
git add ConflictedFile1 ConflictedFile2
git rebase --continue
另外,如果你在原始存储库之上重新分支你的分支,这相当于重写你的github分支的公共历史记录,所以你必须git push -f origin master
才能使这个工作,因为主人有一个不同的历史。
答案 1 :(得分:1)
错误仅仅是因为rebase
命令是不必要的。
rebase
重写当前分支的git索引历史记录,该记录未在master
分支上建议。
您只需pull
将更改同步到master
。
git remote add upstream [...]
git pull upstream master
由于您尚未开始分支机构,我建议您重置分支机构:
git reset --hard upstream/master --
git push origin master