Git 变基导致与不再存在的 .idea 文件发生冲突
Git rebase causing conflict with .idea files that no longer exist
我在自己的分支上,在 5 或 6 次提交前我遇到了这个问题
First, rewinding head to replay your work on top of it...
Applying: commit x
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: The following untracked working tree files would be overwritten by merge:
.idea/.gitignore
.idea/credit-policy-runs.iml
.idea/dataSources.xml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
Please move or remove them before you merge.
Aborting
error: Failed to merge in the changes.
Patch failed at 0001 commit x
hint: Use 'git am --show-current-patch' to see the failed patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
当我无法执行 git rm 和 git rebase --continue 前一阵子我遇到了类似的问题,但我认为我已经解决了它,显然我只是把它推迟了。
更新:当我删除 vim .idea/.git 时忽略了一个文件,但是当我 运行 git rm .idea/.git忽略我得到致命的:pathspec '.idea/.gitignore' 不匹配文件
更新:当我尝试 运行 使用 -Xtheirs 进行变基时,我得到了这些错误
CONFLICT (modify/delete): Runs.avpr deleted in origin/develop and modified in HEAD~63. Version HEAD~63 of Runs.avpr left in tree.
CONFLICT (modify/delete): .idea/misc.xml deleted in origin/develop and modified in HEAD~63. Version HEAD~63 of .idea/misc.xml left in tree at .idea/misc.xml~HEAD~63.
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
git stash
git pull origin master --rebase
如果出现冲突,解决冲突并
git add .
git rebase --continue
重复直到消息倒带...
git stash pop
据我在那里读到的,这些文件没有在你的分支上被跟踪(好... IDE 元数据文件不应该被跟踪)......但是在 other 分支文件被跟踪....这可能不正确。去查看 why/when 文件已添加到该分支并将它们从分支中删除(有大量的方法可以从分支的历史记录中删除文件),然后当您尝试合并时不会发生这种情况。
How can I delete a file from a Git repository?
对于那些遇到这个问题的人,我找不到解决方案,而是将整个目录复制到临时目录中,创建一个新分支,然后将其从临时目录移动到新分支。非常残酷,丢失了所有提交历史记录,但这是我唯一能弄清楚的。
按照步骤解决问题
- 从您的项目中获取备份文件
- git结帐大师
- git分支-d"your branch name"
- git拉源主
- git 分支 "your branch name" 然后 git 结帐 "your branch name"
- 从备份中复制修改后的文件并粘贴到项目文件夹中
如果git rm 无效
终于推送你的代码了
我在自己的分支上,在 5 或 6 次提交前我遇到了这个问题
First, rewinding head to replay your work on top of it...
Applying: commit x
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: The following untracked working tree files would be overwritten by merge:
.idea/.gitignore
.idea/credit-policy-runs.iml
.idea/dataSources.xml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
Please move or remove them before you merge.
Aborting
error: Failed to merge in the changes.
Patch failed at 0001 commit x
hint: Use 'git am --show-current-patch' to see the failed patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
当我无法执行 git rm 和 git rebase --continue 前一阵子我遇到了类似的问题,但我认为我已经解决了它,显然我只是把它推迟了。
更新:当我删除 vim .idea/.git 时忽略了一个文件,但是当我 运行 git rm .idea/.git忽略我得到致命的:pathspec '.idea/.gitignore' 不匹配文件
更新:当我尝试 运行 使用 -Xtheirs 进行变基时,我得到了这些错误
CONFLICT (modify/delete): Runs.avpr deleted in origin/develop and modified in HEAD~63. Version HEAD~63 of Runs.avpr left in tree.
CONFLICT (modify/delete): .idea/misc.xml deleted in origin/develop and modified in HEAD~63. Version HEAD~63 of .idea/misc.xml left in tree at .idea/misc.xml~HEAD~63.
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
git stash
git pull origin master --rebase
如果出现冲突,解决冲突并
git add .
git rebase --continue
重复直到消息倒带...
git stash pop
据我在那里读到的,这些文件没有在你的分支上被跟踪(好... IDE 元数据文件不应该被跟踪)......但是在 other 分支文件被跟踪....这可能不正确。去查看 why/when 文件已添加到该分支并将它们从分支中删除(有大量的方法可以从分支的历史记录中删除文件),然后当您尝试合并时不会发生这种情况。
How can I delete a file from a Git repository?
对于那些遇到这个问题的人,我找不到解决方案,而是将整个目录复制到临时目录中,创建一个新分支,然后将其从临时目录移动到新分支。非常残酷,丢失了所有提交历史记录,但这是我唯一能弄清楚的。
按照步骤解决问题
- 从您的项目中获取备份文件
- git结帐大师
- git分支-d"your branch name"
- git拉源主
- git 分支 "your branch name" 然后 git 结帐 "your branch name"
- 从备份中复制修改后的文件并粘贴到项目文件夹中 如果git rm 无效
终于推送你的代码了