Git分支行为奇怪 [英] Git branches behaving strangely

查看:152
本文介绍了Git分支行为奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来好像我无意中修改了我的git配置,这样当我从branchA切换到master时,所有更改都会自动合并到master。没有我在branchA中提交或者我并入master。在过去,如果我在修改跟踪文件之后尝试切换分支,而没有提交,我得到了未提交的更改,无法切换分支消息,但现在我无法引发该行为。有些东西已经改变了我的git配置,但我不知道它可能是什么。这听起来对任何人都很熟悉吗?



任何帮助都非常感谢。



unbuntu 10.10

git 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 =原点
branch.master.merge = refs / heads / master
submodule.config / shared_capistrano.url = ****************** capistrano.git
submodule.vendor / plugins / authentication_client.url = ********************。git
branch.dev.remote =原始
分支.dev.merge = refs / heads / dev
branch.1.3.9.remot e = origin
branch.1.3.9.merge = refs / heads / 1.3.9


解决方案

当您切换分支并且文件仅在本地修改时,Git不会给您警告/消息(并且会将更改合并到其他分支中)。例如,您在 master 上创建了一个分支 temp ,并对该文件进行本地修改。现在,当你切换到 master 时,你将不会收到消息。另一方面,如果在 temp 中进行了更改并将它们提交(即 temp 从 > master )和然后你有本地修改,当你切换到 master 时, p>

It seems like I have inadvertently modified my git config such that when I switch from branchA to master all changes are automatically merged to master. This happens without either my committing in branchA or my merging to master. In the past if I tried to switch branches after modifying a tracked file and without committing, I got "the uncommitted changes, can't switch branches" message, but now I'm unable to induce that behavior. Something has changed with my git config, but I have no idea what it might be. Does this sound familiar to anyone?

Any help is greatly appreciated.

unbuntu 10.10
git 1.7.1
github.com

here's my 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

解决方案

When you are switching branch and the files are only locally modified, Git will not give you the warning / message ( and will merge the changes into the other branch). For example, you have your repo on master, create a branch temp, have a local modification on the file. Now, when you switch to master you won't get the message. If on the other hand you makes changes in temp and commit them ( that is temp diverges from master ) and then you have local modifications, it will give you that message when you switch to master

这篇关于Git分支行为奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆