所以我在编辑它之前忘了拉我的代码然后当我提交新代码并尝试推送时,我得到错误推送是不可能的,那时我做了一个"git pull",这使得一些文件突出显示冲突.我删除了冲突,但我不知道该怎么做...
我git commit再次尝试,但它说"提交是不可能的,因为你有未合并的文件"
jon*_*ten 203
如果您已修复了需要将文件添加到舞台上的冲突git add [filename],则正常提交.
Pra*_*thi 43
你需要做两件事.首先添加更改
git add .
git stash
git checkout <some branch>
Run Code Online (Sandbox Code Playgroud)
它应该解决你的问题,因为它解决了我.
自 git 2.23(2019 年 8 月)以来,您现在有一个快捷方式可以做到这一点:git restore --staged [filepath]。使用此命令,您可以忽略冲突的文件,而无需添加和删除该文件。
例子:
> git status
...
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: file.ex
> git restore --staged file.ex
> git status
...
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: file.ex
Run Code Online (Sandbox Code Playgroud)