在现有存储库中初始化 git flow
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28251527/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Initializing git flow in existing repository
提问by khernik
I already have an existing repository with a couple of branches. Right now I have to initialize git flow here, using the source tree. But when I click on "git flow" button, and it tries to initialize the git flow, I get the following error:
我已经有一个带有几个分支的现有存储库。现在我必须在这里使用源代码树初始化 git flow。但是,当我单击“git flow”按钮并尝试初始化 git flow 时,出现以下错误:
sh.exe C:\Users\Foo\AppData\Local\Atlassian\SourceTree\gitflow_local\gitflow\git-flow init -d
fatal: Working tree contains unstaged changes. Aborting.
Completed with errors, see above.
I used git pull and git push on every branch, no uncommited changes...What's wrong?
我在每个分支上都使用了 git pull 和 git push ,没有未提交的更改......怎么了?
Also, won't using git flow command on existing repo delete any files?
另外,不会在现有 repo 上使用 git flow 命令删除任何文件吗?
回答by npmiller
You have unstagedchanges. Which are changes on files that are tracked by git, but not commited or added, thus they are not staged. If you don't care about these changes you can use:
您有未暂存的更改。哪些是由 git 跟踪但未提交或添加的文件的更改,因此它们不会被暂存。如果您不关心这些更改,您可以使用:
git reset --hard
To get back to you HEAD's state.
回到你 HEAD 的状态。
If you do care about these changes, you should add/commit them before you run your command. (You can see these changes with git diff
).
如果您确实关心这些更改,则应该在运行命令之前添加/提交它们。(您可以使用 看到这些更改git diff
)。
回答by gayan_ms
AS I think you need to commit your changes.
因为我认为您需要提交更改。
git commit -m "my commit message
You should code this.
git commit -m "my commit message
你应该编码这个。
If you don't want to keep your changes. You need to follow the instructions in the git status message and
如果您不想保留更改。您需要按照 git status 消息中的说明进行操作,并且
use git reset HEAD <file>...
用 git reset HEAD <file>...
回答by Nikhil
Run git flow init from the repository folder just like as you would do for new repository
从存储库文件夹运行 git flow init 就像对新存储库所做的一样