尝试在个人项目中使用/学习git。只有我和一个远程git仓库,几次提交,但现在陷入了合并失败的困境。现在我的很多文件都有Git合并冲突标记。
我该如何告诉git只使用我的修改,抛弃其他的?
以下是我遇到问题的具体例子:
echo A new file > myFile.txt # example file
git add myFile.txt # add file
git commit # commit changes
git push # push changes to remote repo
echo A conflicting edit > myFile.txt # oh, no, forgot some changes
git add myFile.txt # add again
git commit --amend # amend previous commit
git push # fails. Git suggests to do a pull first
git pull origin HEAD # "Automatic merge failed" Now what?
# Just use what I have locally!
git mergetool
),查看冗长的文档,一般性的建议如何避免合并等等。当我在谷歌上搜索“Git use local”时,我一直找到有关如何在没有远程源的情况下在计算机上使用git的文章。这真是令人恼火。你是说没有一个一行命令就可以告诉git“使用我的本地”吗? - Kache