尝试拉取远程更改时,收到未跟踪工作树的错误

问题描述 投票:0回答:1

这就是我所做的:

  1. 远程端有拉取更改
  2. 我在本地删除了文件夹
    a
  3. 提交更改
  4. a
    添加回子模块
  5. 提交更改
  6. 尝试推动
  7. 出现以下错误:
To https://git***.com/*******/***.git
! [rejected] Alpha -> Alpha (non-fast-forward)
error: failed to push some refs to 'https://git***.com/*******/***.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. If you want to integrate the remote changes,
hint: use 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  1. 我用
    git pull upstream Alpha
    来拉
  2. 出现以下错误:
From https://git***.com/*******/***.git
 * branch              Alpha      -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by checkout:
- Some files in folder `a`
Aborting
error: could not detach HEAD

经过搜索,发现下面的方法不起作用以及对应的性能:

$ git status
On branch Alpha
nothing to commit, working tree clean
$ git submodule status
7f6cf82534ccb90380643673c87fca6716b60d3d Python (heads/main)

我想了解我需要做什么才能使推/拉正常工作。

git git-submodules
1个回答
0
投票

尝试以下操作:

  1. 取消初始化子模块:
    git submodule deinit [submodule name]
  2. 物理移除子模块(如果存在):
    rm [module directory name]
  3. 再次尝试从遥控器拉出模块:
    git submodule update --init
  4. 尝试拉动:
    git pull

除了步骤 3,尝试使用与之前(在远程)相同的远程路径和本地名称重新添加模块:

git submodule add [old submodule remote path] [old submodule directory name]

© www.soinside.com 2019 - 2024. All rights reserved.