将本地合并到开发环境中的冲突

Conflict merging local into develop environment

所以因为我犯了一个小错误,我在将我的本地文件合并到我的开发环境时发生了冲突。

我正在维护一个 Wordpress 网站。 我通过首先在本地环境中测试更新而不是将其推送到开发环境来做到这一点,但我不小心更新了开发环境中的几个插件而没有注意到。 当我注意到我切换到本地文件并在那里进行更新时,当我想将本地文件合并到开发环境时,我在终端中收到此错误。

> * branch            develop    -> FETCH_HEAD
Updating f08f8fb..c72a8b7
error: The following untracked working tree files would be overwritten by merge:
    wp-content/plugins/redirection/api/api.php
    wp-content/plugins/redirection/redirection-capabilities.php
    wp-content/plugins/w3-total-cache/BrowserCache_Environment_Nginx.php
    wp-content/plugins/w3-total-cache/BrowserCache_Page_View_SectionSecurity.php
    wp-content/plugins/w3-total-cache/Cdn_Environment_Nginx.php
    wp-content/plugins/w3-total-cache/Extension_Amp_Page_View.php
    wp-content/plugins/w3-total-cache/Generic_Page_PurgeLog.php
    wp-content/plugins/w3-total-cache/Generic_Page_PurgeLog_View.php
    wp-content/plugins/w3-total-cache/LazyLoad_Mutator.php
    wp-content/plugins/w3-total-cache/LazyLoad_Mutator_Picture.php
    wp-content/plugins/w3-total-cache/LazyLoad_Mutator_Unmutable.php
    wp-content/plugins/w3-total-cache/ObjectCache_Page_View_PurgeLog.php
    wp-content/plugins/w3-total-cache/Util_DebugPurgeLog_Reader.php
    wp-content/plugins/wordfence/css/activity-report-widget.1579191227.css
    wp-content/plugins/wordfence/css/diff.1579191227.css
    wp-content/plugins/wordfence/css/dt_table.1579191227.css
    wp-content/plugins/wordfence/css/fullLog.1579191227.css
    wp-content/plugins/wordfence/css/iptraf.1579191227.css
    wp-content/plugins/wordfence/css/jquery-ui-timepicker-addon.1579191227.css
    wp-content/plugins/wordfence/css/jquery-ui.min.1579191227.css
    wp-content/plugins/wordfence/css/jquery-ui.structure.min.1579191227.css
    wp-content/plugins/wordfence/css/jquery-ui.theme.min.1579191227.css
    wp-content/plugins/wordfence/css/main.1579191227.css
    wp-content/plugins/wordfence/css/phpinfo.1579191227.css
    wp-content/plugins/wordfence/css/wf-adminbar.1579191227.css
    wp-content/plugins/wordfence/css/wf-colorbox.1579191227.css
    wp-content/plugins/wordfence/css/wf-font-awesome.1579191227.css
    wp-content/plugins/wordfence/css/wf-global.1579191227.css
    wp-content/plugins/wordfence/css/wf-ionicons.1579191227.css
    wp-content/plugins/wordfence/css/wf-onboarding.1579191227.css
    wp-content/plugins/wordfence/css/wf-roboto-font.1579191227.css
    wp-content/plugins/wordfence/css/wfselect2.min.1579191227.css
    wp-content/plugins/wordfence/css/wordfenceBox.1579191227.css
    wp-content/plugins/wordfence/js/Chart.bundle.min.1579191227.js
    wp-content/plugins/wordfence/js/admin.1579191227.js
    wp-content/plugins/wordfence/js/admin.ajaxWatcher.1579191227.js
    wp-content/plugins/wordfence/js/admin.liveTraffic.1579191227.js
    wp-content/plugins/wordfence/js/date.1579191227.js
    wp-content/plugins/wordfence/js/jquery-ui-timepicker-addon.1579191227.js
    wp-content/plugins/wordfence/js/jquery.colorbox-min.1579191227.js
    wp-content/plugins/wordfence/js/jquery.colorbox.1579191227.js
    wp-content/plugins/wordfence/js/jquery.dataTables.min.1579191227.js
    wp-content/plugins/wordfence/js/jquery.qrcode.min.1579191227.js
    wp-content/plugins/wordfence/js/jquery.tmpl.min.1579191227.js
    wp-content/plugins/wordfence/js/jquery.tools.min.1579191227.js
    wp-content/plugins/wordfence/js/knockout-3.3.0.1579191227.js
    wp-content/plugins/wordfence/js/wfdashboard.1579191227.js
    wp-content/plugins/wordfence/js/wfdropdown.1579191227.js
    wp-content/plugins/wordfence/js/wfglobal.1579191227.js
    wp-content/plugins/wordfence/js/wfpopover.1579191227.js
    wp-content/plugins/wordfence/js/wfselect2.min.1579191227.js
    wp-content/plugins/wordfence/modules/login-security/css/admin-global.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/admin.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/colorbox.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/font-awesome.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/ionicons.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/jquery-ui-timepicker-addon.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/jquery-ui.min.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/jquery-ui.structure.min.1579191227.css
    wp-content/plugins/wordfence/modules/login-security/css/jquery-ui.theme.min.1579191227.css
    wp-content/plugins/wordfence/modules/login-secu
Aborting

您有未跟踪的文件,您的传入本地分支正在尝试写入这些文件。因为当你试图覆盖文件时,覆盖后旧的文件将永远消失,而git非常擅长检测这些冲突并努力警告你以防止任何数据丢失。

如果 "accidentally" 是真的意思,用本地分支覆盖它们应该没问题。在开发环境中,您可以先丢弃您所做的任何更改

git ls-files --others --exclude-standard | xargs rm -rf

这将删除所有那些未跟踪的文件。然后您可以再次合并您的本地分支。