[英]Stop git from allowing me to switch branches with uncommitted changes
I understand the behaviour (and usefulness) of being able to switch branches when you have uncommitted changes. 我了解当您未提交更改时能够切换分支的行为(和有用性)。 However, in 99.9% of my workflow this is undesirable because it means I've forgotten to commit changes before switching to a different feature branch.
但是,在我99.9%的工作流中,这是不希望的,因为这意味着我忘记了切换到其他功能分支之前所做的更改。 Is there a setting somewhere that I can set to either not allow a switch with uncommitted changes or to at least give a warning?
是否可以在某处进行设置,以允许不允许进行未提交的更改的开关,或者至少发出警告?
There does not seem to be a config for that case (checkout with a dirty index). 在这种情况下似乎没有配置(带有脏索引的检出)。
That leaves you with writing a script git-co
(which can be called as git co
) which will: 这样您就可以编写脚本
git-co
(可以称为git co
),该脚本将:
Note: there is no pre-checkout hook , even though one was proposed in 2009 . 注意:即使在2009年提出了 钩子 ,也没有预结帐钩子 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.