我正在my-branch从 master 创建的分支 ( )上工作。
$ git checkout -b my-branch
Run Code Online (Sandbox Code Playgroud)
我编辑了一些文件,然后将它们签入新分支:
$ git commit -a -m 'Add new feature'
Run Code Online (Sandbox Code Playgroud)
然后我从 master 那里拉出来(我不完全确定我为什么这样做,或者它是否是好的做法):
$ git pull origin master
Run Code Online (Sandbox Code Playgroud)
但是拉动给了我很多错误信息:
From github.com
* branch master -> FETCH_HEAD
Auto-merging styles/common/module_more_info.scss
CONFLICT (add/add): Merge conflict in styles/common/module_more_info.scss
Auto-merging app/support/stagecraft_stub/responses/cloud.json
CONFLICT (content): Merge conflict in app/support/stagecraft_stub/responses/cloud.json
Auto-merging app/support/backdrop_stub/response_fetcher.js
CONFLICT (content): Merge conflict in app/support/backdrop_stub/response_fetcher.js
Automatic merge failed; fix conflicts and then commit the result.
vagrant@pp-development-1:/var/apps/spotlight$ git status
Run Code Online (Sandbox Code Playgroud)
git status现在运行会显示许多更改的文件:
# 在分支 my-branch
# Changes to be committed:
#
# modified: CONTRIBUTING.md
# modified: README.md
# modified: app/appBuilder.js
[lots more files]
#
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: app/support/backdrop_stub/response_fetcher.js
# both modified: app/support/stagecraft_stub/responses/cloud.json
# both added: styles/common/module_more_info.scss
Run Code Online (Sandbox Code Playgroud)
首先,发生了什么,其次,我该怎么办?
如果我尝试查看任何上层文件列表中的差异,则会得到空输出,这令人困惑(如果没有差异,为什么要我提交文件?):
$ git diff CONTRIBUTING.md
$
Run Code Online (Sandbox Code Playgroud)
我应该查看 下的三个文件,Unmerged paths然后将其作为合并提交提交吗?更新:最重要的是,我可以将它推送到我的分支而不会弄乱主分支吗?
我似乎无法回滚上次提交。
小智 -2
打开冲突文件并解决删除差异。
然后:
git add .
git commit -am "resolve conflicts"
git push origin master
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17221 次 |
| 最近记录: |