git - Ignored files in Git would be overwritten by merge
问题描述
When I do pull in my server, this is the message I get:
error: Your local changes to the following files would be overwritten by merge: css/custom.css images/logo.png Please, commit your changes or stash them before you can merge.
But those 2 files are ignored in my .gitignore like this:
# general
inc/config.php
css/custom.css
favicon.ico
What I am doing wrong? Thanks in advance!
解决方案
1) Some team member has already committed those file so when you make a git pull you will recover those committed files changes and in your next commit those files will be considered as ignored file.
2) Before merging you need to:
- commit your modifications:
git add path/to/modified-file
thengit commit -m "commit message"
and finallygit pull
Or
- Stash your modifications:
git stash
thengit pull
And to recover your modifications again usegit stash pop
推荐阅读
- sql-server - 可以从SSMS用sa用户名打开表,但不能用sa用户名登录软件
- php - 如果缺少某个变量,则重定向会创建一个错误,指出该变量丢失
- html - .includes() 如果与之关联的变量没有变化,是否会在变化检测循环期间运行?/ 替代 .includes()
- r - 替换特定的列名和行名
- python - 使用 RabbitMQ 消息代理的 Airflow 分布式消息流
- webhooks - 创建文件时使用运行脚本流调用 webhook
- python - 有没有办法将文本文件读取为整数而不是列表?
- .net - 从哪里获取部署在 Azure Web 应用程序中的应用程序日志
- node.js - 获取和发布请求继续在邮递员/浏览器中加载
- woocommerce - 购物车页面上提供的邮政编码不会显示在结帐页面上。显示用户在创建帐户时使用的邮政编码