有没有一个命令可以撤销git flow init?

112

在运行git flow init后,如何删除git flow模型?
我如何从.git/config文件中删除所有相关配置?

$ git flow init
# force reset
$ git flow init -f
如何从.git/config文件中删除以下内容?
[gitflow "branch"]
    master = master
    develop = develop
[gitflow "prefix"]
    feature = feature/
    release = release/
    hotfix = hotfix/
    support = support/
    versiontag = 

可能是重复的线程 https://dev59.com/SHA75IYBdhLWcg3wlqOh - codebreaker
5
@codebreaker,感谢您的回复。这个帖子#3212459是关于git init而不是git flow init的... - payliu
2个回答

159
你也可以从命令行执行 @Peter 提到的操作!这些命令将删除与 gitflow 相关的 git 配置文件中的所有部分。
git config --remove-section "gitflow.path"
git config --remove-section "gitflow.prefix"
git config --remove-section "gitflow.branch"

然后您可以像往常一样重新初始化gitflow。

git flow init

1
生命救星。非常感谢你。 - CIRCLE
通过Eclipse初始化Gitflow时,“gitflow.path”不存在。 - softwarevamp
2
git config --remove-section "gitflow.path" && git config --remove-section "gitflow.prefix" && git config --remove-section "gitflow.branch"请执行以上命令,以移除“gitflow.path”、“gitflow.prefix”和“gitflow.branch”部分的配置。 - Code Spirit
啊啊 @miva2,我很高兴自己有两次的用处。 - danidemi

40
如果您从配置文件中删除了这些部分,任何对git-flow的引用都会消失。
不过其实没有必要删除任何东西,git-flow模型只是一种模型。您可以随时使用标准Git命令。
git-flow添加到您的配置文件中的内容只有git-flow软件会使用,而不是Git本身。

4
我认为@payliu遇到的问题是,在运行git flow init时,您设置的值不能通过再次运行git flow init来重置。当您运行git flow init时,git flow工具会对您的repo做出假设,这些假设可能不正确。请参见开发人员在此处遇到的问题:https://github.com/nvie/gitflow/issues/121 - ThomasW

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接