繁体   English   中英

git checkout -f staging 致命:无法在“public/C:\\xamppphp8\\htdocs\\caab-hcc\\storage\\logs”处创建目录:无效参数

[英]git checkout -f staging fatal: cannot create directory at 'public/C:\xamppphp8\htdocs\caab-hcc\storage\logs': Invalid argument

我正在尝试从寡妇 PowerShell 以这种方式结帐 git checkout -f (我的操作系统是windows 10

git checkout -f staging 

git checkout -q --track origin/staging fatal: 无法在“public/C:\\xamppphp8\\htdocs\\caab-hcc\\storage\\logs”处创建目录:无效参数

我可以从同一个存储库轻松检出其他分支,但是当我要使用Staging 分支时,我收到此错误

它的 Laravel 项目

    > git for-each-ref --format %(refname:short)%00%(upstream:short) refs/heads
> git checkout -q --track origin/staging
fatal: cannot create directory at 'public/C:\xamppphp8\htdocs\caab-hcc\storage\logs': Invalid argument
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/bangla_inpout_field_with_new_api refs/remotes/bangla_inpout_field_with_new_api
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
Warning: Failed to watch ref 'c:\xamppphp8\htdocs\caab-hcc-1\.git\refs\remotes\origin\bangla_inpout_field_with_new_api', is most likely packed.
> git config --get commit.template

没有 -f 标志

git checkout staging
error: The following untracked working tree files would be overwritten by checkout:
        bootstrap/cache/config.php
        bootstrap/cache/packages.php
        bootstrap/cache/routes-v7.php
        bootstrap/cache/services.php
Please move or remove them before you switch branches.
Aborting

该错误已经告诉您问题所在。 您已在当前分支中进行了更改,这些更改将通过检出staging分支来覆盖。

您的问题有两种解决方案:

  1. 删除当前分支中的更改( git checkout .您将丢失更改。

如果您还想删除添加的文件并且不关心丢失进度,请使用: git reset --hard; git clean -df

  1. 使用git stash来存储您的更改。 您的藏匿处可以在以后重新应用。

之后, git checkout staging应该会再次工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM