Py学习  »  Git

我正在使用ij idea。如何避免git pull操作失败?

marlowex • 5 年前 • 1405 次点击  

它显示的信息有点像

your local files will be override.......

gitignore文件有问题吗?
我该怎么做才能完全消除它呢?谢谢!

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43053
 
1405 次点击  
文章 [ 1 ]  |  最新文章 5 年前
CodeWizard
Reply   •   1 楼
CodeWizard    6 年前

这和 .gitignore 这意味着当其他人在远程存储库中修改同一文件时,您有未提交的更改。

提交更改,然后执行拉取

# add your files to the staging area
git add . (or any other file that you need)

git commit

# now pull
git pull

或者如果你不想承诺:

git stash 

# now pull
git pull

我没有提交.idea目录中的文件,因为我想将其推送到远程分支,并且禁止将这些文件推送到远程分支。

  • 如果您没有将它们添加到gitignore中,请添加它们
  • 如果已经提交,请将其从索引中删除

    # remve the commited files
    git rm --cached <file list>
    

或者如果你想把它们从历史中完全删除

BFG - https://rtyley.github.io/bfg-repo-cleaner/

enter image description here

从现在起使用此忽略文件:

https://www.gitignore.io/api/intellij