我正在迈克尔哈特尔的“Ruby教程”的第5章。我试图合并分支,在错误的分支上,把自己带到兔子洞里。在做了一些回溯之后,我已经走了很远的路,但现在这又是我的问题了。
****Captains-iMac:sample_app owner$ git pull origin master
U app/views/layouts/application.html.erb
U app/views/static_pages/home.html.erb
U config/routes.rb
U test/controllers/static_pages_controller_test.rb
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution and make a commit.****
主分支是目前对我来说正确的分支。有关完整新手的任何指示吗?
答案 0 :(得分:3)
您可以做的一件事是使用git checkout <file>
检出文件的已提交版本(从而丢弃您的更改),或git reset --hard HEAD
以丢弃所有文件的任何未提交的更改。
警告:后者将丢弃所有本地更改。只有在您不特别关心在本地进行的更改时才这样做。
否则,我建议您查看这个优秀的post,其中接受答案的作者深入了解您目前遇到的问题类型。
希望这可以帮助你。
答案 1 :(得分:1)
这些是相互冲突的文件:
git pull origin master
U app/views/layouts/application.html.erb
U app/views/static_pages/home.html.erb
U config/routes.rb
U test/controllers/static_pages_controller_test.rb
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution and make a commit.
以下是我输入的解决方法:
Captains-iMac:sample_app所有者$ git add app / views / layouts / application.html.erb Captains-iMac:sample_app所有者$ git add app / views / static_pages / home.html.erb Captains-iMac:sample_app owner $ git add config / routes.rb Captains-iMac:sample_app所有者$ git add 测试/控制器/ static_pages_controller_test.rb Captains-iMac:sample_app所有者$ git commit -m“已解决合并冲突” [master 891a992]解决了合并冲突