无法将master分支合并到gh-pages [英] can't merge master branch to gh-pages

查看:182
本文介绍了无法将master分支合并到gh-pages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经签出了gh-pages分支.我尝试git merge master,并且收到以下错误消息:以下未跟踪的工作树文件将被合并覆盖:...请先移动或删除它们,然后再进行合并.那正是我想做的.我希望master分支上的文件覆盖gh-pages分支上的相同文件的版本.我已经阅读了git rm...命令的版本,并尝试了git stashgit reset head.我仍然遇到相同的错误.

I have checked out gh-pages branch. I try git merge master and I receive the following "error: The following untracked working tree files would be overwritten by merge: ... Please move or remove them before you can merge." That's exactly what I want to do. I want the files on the master branch to override the versions of those same files on the gh-pages branch. I have read up a little on versions of the git rm... command and also tried git stash and git reset head. I still get the same error.

简而言之,我该如何忽略gh页的当前状态并用master分支覆盖它们?

In short, how do I ignore the current status of gh-pages and overwrite them with master branch?

推荐答案

您的当前分支上有一些未跟踪的文件,这些文件已在master分支上进行了版本控制.合并母版(或检出母版)将覆盖它们,而无法将其撤消. Git始终会尝试阻止您丢失无法恢复的数据,除非您明确要求这样做.您可以执行以下操作:

You have some untracked files on your current branch that are versioned on master branch. Merging master (or checking out master) would overwrite them without the possibility to reverse that. Git always tries to prevent you from loosing data that cannot be restored until you explicitly told it to do so. Here are the things you can do:

  1. git clean -f(但首先运行--dry-run以查看是否不删除实际上不想删除的内容)
  2. 使用rm(不是git rm)删除列出的文件
  3. git stash -u
  4. 添加未跟踪的文件,提交它们,然后合并.

以及可能要摆脱的许多其他事情.

and probably many other things to get rid of them.

这篇关于无法将master分支合并到gh-pages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆