在更新项目代码时,需要修改配置文件,为了避免在更新代码时重新pull配置文件,使用.gitignore可以解决此问题。

首先,在配置文件所在目录创建文件.gitignore(git bash里使用命令touch .gitignore)

然后,.gitignore配置需要忽略的文件

.gitignore

settings.py

最后,保存后执行git命令:

git rm --cached setting.py

git add .gitignore

git commit -m "We really don't want Git to track this anymore!"

检查:git pull就不会更新该文件

相关文章:

  • 2022-12-23
  • 2022-02-07
  • 2021-08-11
  • 2022-02-15
  • 2022-02-21
  • 2022-01-18
  • 2021-06-25
  • 2021-11-12
猜你喜欢
  • 2022-12-23
  • 2022-02-05
  • 2022-01-29
  • 2022-02-16
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
相关资源
相似解决方案