【发布时间】:2023-03-16 23:01:02
【问题描述】:
似乎我无意中修改了我的 git 配置,这样当我从 branchA 切换到 master 时,所有更改都会自动合并到 master。这发生在我没有在 branchA 中提交或我合并到 master 的情况下。过去,如果我在修改跟踪文件后尝试切换分支并且没有提交,我会收到“未提交的更改,无法切换分支”消息,但现在我无法诱导这种行为。我的 git 配置发生了一些变化,但我不知道它可能是什么。有没有人觉得这很熟悉?
非常感谢任何帮助。
Ubuntu 10.10
混帐 1.7.1
github.com
这是我的 git config -l:
giggle.main-window-maximized=false
giggle.main-window-geometry=993x731+318+160
giggle.history-view-vpane-position=223
giggle.main-window-view=HistoryView
giggle.file-view-vpane-position=153
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=**************************************
branch.master.remote=origin
branch.master.merge=refs/heads/master
submodule.config/shared_capistrano.url=******************capistrano.git
submodule.vendor/plugins/authentication_client.url=********************.git
branch.dev.remote=origin
branch.dev.merge=refs/heads/dev
branch.1.3.9.remote=origin
branch.1.3.9.merge=refs/heads/1.3.9
【问题讨论】:
-
您是在谈论您的 未提交 更改被传递到主分支还是其他什么?
-
您可以通过
git config -l列出您的配置。把它贴在这里(不包括任何秘密),也许有人会发现一些奇怪的东西。 -
谢谢,是的,这听起来像是我所看到的重复,但我真正的问题是警告信息。我现在明白为什么文件在更改后出现在 master 中,但我仍然不明白为什么我不再收到警告“你有未提交的更改,无法切换分支”。这是一个非常有用的警告。
-
@user508546:如果未提交的更改与目标分支中所做的更改冲突,您只会看到“无法切换分支”消息。
mkdir temp && cd temp && git init && echo foo master1 >foo && git add foo && git commit -mm1 && git branch other && echo foo master2 >>foo && git add foo && git commit -mm2 && git checkout other && echo foo other1 >>foo && git checkout master产生error: Your local changes to the following files would be overwritten by checkout: …。如果您从 master 中删除冲突的“m2”,它会起作用:git branch -f master master~ && git checkout master.
标签: git