Git 与 workspace.xml 合并冲突
Git merge conflict with workspace.xml
我正在尝试将我的 Rails 项目推送到 Heroku,但 Git 目前不允许我做任何事情。这是我到目前为止所做的:
git push heroku
失败,因为 heroku b运行ch 是我本地 b运行ch 的 "ahead",这不应该是可能的。
- 我拉了,和
.idea/workspace.xml
有冲突。我无法找出那个文件是什么,但它很大,Git 向其中写入了各种乱码。手动太多了 "resolve" 冲突。
- 我看到一些 Whosebug 帖子在谈论 git-忽略该文件(也许是 RubyMine 或其他东西的一些 IDE 文件?),所以我试图将文件移开以避免冲突
- 我运行
git add -A
(也试过git add .
和git add
)
git commit --amend
失败,因为 "You are in the middle of a merge"
git merge --abort
失败,因为“未跟踪的工作树文件 '.idea/workspace.xml' 将被合并覆盖(尽管文件已被移动)
git reset --merge
因同样原因失败。
如何让 Git 重新工作?
git commit -am "message"
有效(与修改提交相反)
.idea/workspace.xml
此文件是您的想法工作区文件。它们由 IntelliJ 工具生成。
I saw some Whosebug posts talking about git-ignoring that file (maybe it's some IDE file for RubyMine or something?), so I tried to move the file away to avoid the conflict
只需将 文件夹 添加到您的 .gitignore
但由于它已经提交,您必须将其从存储库中删除:
# Quit the merge
git merge --abort
# remove the whole folder from the repo
git rm -rf --cached .idea/
# add it to the .gitignore: idea/
# add and commit your changes
git add .- A
git commit -m " Removed idea folder"
git push origin <branch>
如果还是做不到?
首先将代码重置为之前的状态,然后再次执行上述代码。
重置会将您带到拉取之前的最后一次提交
我正在尝试将我的 Rails 项目推送到 Heroku,但 Git 目前不允许我做任何事情。这是我到目前为止所做的:
git push heroku
失败,因为 heroku b运行ch 是我本地 b运行ch 的 "ahead",这不应该是可能的。- 我拉了,和
.idea/workspace.xml
有冲突。我无法找出那个文件是什么,但它很大,Git 向其中写入了各种乱码。手动太多了 "resolve" 冲突。 - 我看到一些 Whosebug 帖子在谈论 git-忽略该文件(也许是 RubyMine 或其他东西的一些 IDE 文件?),所以我试图将文件移开以避免冲突
- 我运行
git add -A
(也试过git add .
和git add
) git commit --amend
失败,因为 "You are in the middle of a merge"git merge --abort
失败,因为“未跟踪的工作树文件 '.idea/workspace.xml' 将被合并覆盖(尽管文件已被移动)git reset --merge
因同样原因失败。
如何让 Git 重新工作?
git commit -am "message"
有效(与修改提交相反)
.idea/workspace.xml
此文件是您的想法工作区文件。它们由 IntelliJ 工具生成。
I saw some Whosebug posts talking about git-ignoring that file (maybe it's some IDE file for RubyMine or something?), so I tried to move the file away to avoid the conflict
只需将 文件夹 添加到您的 .gitignore
但由于它已经提交,您必须将其从存储库中删除:
# Quit the merge
git merge --abort
# remove the whole folder from the repo
git rm -rf --cached .idea/
# add it to the .gitignore: idea/
# add and commit your changes
git add .- A
git commit -m " Removed idea folder"
git push origin <branch>
如果还是做不到?
首先将代码重置为之前的状态,然后再次执行上述代码。
重置会将您带到拉取之前的最后一次提交