我在远程git存储库中有一个项目,当我推送代码时,它在远程存储库中显示如下:
<<<<<<< HEAD
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
=======
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
>>>>>>> dev-wip如你所见,这里有一些git注释(?对不起,我不知道该用什么词。)可以在代码中看到,例如:
<<<<<<<<< HEAD
>>>>>>> dev-wip
有没有人能帮我解释为什么它不能正确渲染?
发布于 2018-06-21 21:13:35
出现此问题的原因是,在推送代码之前和执行最后一次拉取或克隆之后之间,文件被修改过。
<<<<<<< HEAD, ======= and >>>>>>> dev-wip构成了git所看到的一组冲突。这些标记告诉我们,=======上面的代码与它下面的代码冲突。
要解决此问题,您应该决定需要保留哪些代码行。要做到这一点,请分析代码并查看哪些更改是相关的,并且应该在最终的合并中出现。之后,决定删除这些标记<<<<<<< HEAD, ======= and >>>>>>>,并确保您的代码是正确的。
避免这种情况的步骤有:
之前尝试获取git pull -r origin <branch_name>
https://stackoverflow.com/questions/50969027
复制相似问题