git - 如果有未提交的更改,是否可以将 git 子模块更新为自动存储?
问题描述
假设我有一个已经在本地和远程更改的 git 项目,所以它已经过时了。
如果我想在不破坏本地工作的情况下升级到最新的远程代码。Git 可以使用以下命令自动完成:
git pull --rebase --autostash
不幸的是,它仅适用于根模块,适用于 git 子模块。我尝试了以下选项:
git submodule foreach git fetch
git submodule update --init --recursive
# git report error:
# Cannot rebase: Your index contains uncommitted changes.
# Please commit or stash them
git submodule foreach git fetch
git submodule update --init --recursive --autostash
# git report syntax error
git submodule foreach git fetch
git submodule update --init --recursive --force
# git destroy local changes
使子模块的行为类似于根模块的正确方法是什么?
解决方案
推荐阅读
- python - Python PyGame 同时按下两个按钮
- python-3.x - 不确定如何解决此覆盖错误
- python - 根据多个 QComboBox 的文本启用或禁用 QDialogButtonBox
- corda - 如果没有交易对手,在 FinalityFlow 中应该使用哪个构造函数?
- javascript - 状态更改后功能组件未重新渲染
- sql - SQL将值从触发器插入视图
- mongodb - 使用 DataImportHandler 连接 MongoDB 和 Solr 8.2
- python - 每次我迁移时,Alembic 都会重新创建外键,导致表上出现重复的外键
- loops - 为什么这个循环在 qlik sense 脚本中不起作用?
- javascript - 如何使用 Selenium 处理 jQuery 应用程序的奇怪行为?