首页 > 解决方案 > 如何在对跳过的文件进行更改的分支上签出

问题描述

我现在的分支是说branch_a

local settings使用以下命令跳过了文件。

git update-index --skip-worktree <file_local_settings>

现在我正在从另一个开发人员的仓库中提取一个分支,该开发人员已经更改了他的版本<file_local_settings>并推送到了他的仓库。

当我尝试结帐到创建的分支时出现以下错误说branch_b从他的分支创建的分支时,我收到以下错误。

error: Your local changes to the following files would be overwritten by checkout:

我的问题是什么是优雅的结账方式branch_b

标签: git

解决方案


好的,所以我所做的就是跟随。

  1. git update-index --no-skip-worktree <file_local_settings>
  2. 无论如何,我不想将我的更改推送到<file_local_settings>我跑
  3. git reset --hard#要小心,否则你可以这样做git checkout <file_local_settings>
  4. git结帐branch_b
  5. git update-index --skip-worktree <file_local_settings>

推荐阅读