git - How to develop between branches when you have permanent unstaged changes?
问题描述
I have my whole production code in a repository and locally I had to changed some backend/frontend code out of neccessity and leave them in a permanant "unstaged change" mode.
Since I did all the test locally, I didn't need to use branches until today.
We now have a dev
branch and I commit my changes to dev
then checkout master
and git merge dev
.
The only issue is that anytime my change happens to one of those unstaged files, I get the famous:
Please commit your changes or stash them before you switch branches.
Aborting
This answer somehow helps https://stackoverflow.com/a/22424970 but this is not an efficient way for me to do this on every commit.
Is there any way I can do less work on each commit/merge?
解决方案
并非所有这些,新的部分都已提交,其余部分保留。
好吧,但那是你的问题。文件是 git 中思想的原子单位。您不能仅将文件的一部分标记为 git 权限之外。如果您向 git 显示任何文件,git 现在知道整个文件并看到(并且正确地说)您已修改。这就是你正在做的事情。
所以,你有相互矛盾的欲望。基本上,如果您要以这种方式工作,那么您必须承受后果。
推荐阅读
- python - 在 python 上写入 CSV 文件的问题
- python - PHP加密和解密函数到python
- javascript - 来自现有数组的表单中的 React Dropdown
- powershell - Microsoft Teams:将成员从一个 Teams 组迁移到另一个
- php - 使用 handler.postDelayed (Android) 创建实时应用程序?
- jmeter - 在高斯分布中生成http请求
- python - 使用 python 从 FQDN 获取 url
- python - python 3中的EOL是什么意思?
- reactjs - React Hook "useState" 在函数 "deviceStatus" 中被调用,它既不是 React 函数组件也不是自定义 React
- python - boost python 3.7:来自 cpp 和 python 的打印顺序错误