错误:checkout:wp-config.php将覆盖对以下文件的本地更改

时间:2017-10-13 14:36:55

标签: wordpress git

我在执行git status命令时收到“nothing to commit, working directory clean”消息

但是当执行git checkout时,branch-name会产生错误:

error: Your local changes to the following files would be overwritten by checkout: wp-config.php

请使用输出检查bellow git命令:

shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git update-index --assume-unchanged -- wp-config.php
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   .gitignore

no changes added to commit (use "git add" and/or "git commit -a")
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git diff .gitignore
diff --git a/.gitignore b/.gitignore
index d9d785e..d180ece 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,3 @@ wp-content/plugins/wordpress-seo/
 wp-content/plugins/wp-mail-smtp/
 wp-content/plugins/jetpack/
 wp-content/plugins/google-sitemap-generator/
-wp-config.php
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git add .gitignore

shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git commit -F ../commitmsg.txt
[master d265e1a] Remove wp-config.php file from gitignore because with .gitignore, only untracked files are ignored.
 1 file changed, 1 deletion(-)
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git status
On branch master
nothing to commit, working directory clean
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git push origin master
Password for 'https://user_name@bitbucket.org': 
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 488 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 1 (delta 1)
To https://user_name@bitbucket.org/user_name/atoz-reviews.git
   c7bebee..d265e1a  master -> master
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git status
On branch master
nothing to commit, working directory clean
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git checkout develop
error: Your local changes to the following files would be overwritten by checkout:
    wp-config.php
Please, commit your changes or stash them before you can switch branches.
Aborting
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git stash save "Unknown changes with not file to commit"
No local changes to save
shahalom@microsolutionsbd ~/www/wp-projects/atoz-reviews $ git checkout develop
error: Your local changes to the following files would be overwritten by checkout:
    wp-config.php
Please, commit your changes or stash them before you can switch branches.
Aborting

我认为它与git update-index --assume-unchanged -- wp-config.php命令有关......但解决方案是什么?

0 个答案:

没有答案