我试图摆脱我的“未暂存的更改”,并且我的 Gemfile.lock 不断重新出现为未暂存的文件。我相信这是因为我更新了 bundler,因为更改是:
-
- BUNDLED WITH
- 1.10.5
首先,这些不起作用,因为 Gemfile.lock 会自行更新:
git checkout -- Gemfile.lock
git stash save --keep-index --include-untracked
git stash drop
git reset HEAD
git clean -df
git checkout -- .
起作用的是:
git update-index --assume-unchanged Gemfile.lock
看起来不错,运行“git status”:
On branch develop
Your branch is up-to-date with 'origin/develop'.
nothing to commit, working directory clean
我无法运行“git checkout origin/existing_branch”
error: Your local changes to the following files would be overwritten by checkout:
Gemfile.lock
Please, commit your changes or stash them before you can switch branches.
Gemfile.lock 的最佳实践是什么?如何在忽略远程的情况下从远程拉出新分支?