0

I have a project in remote git repository and when I push the code it is showing as following in the remote repository:

<<<<<<< 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

As you can see there are some git comments(? I don't know the proper term, sorry.) can be seen in the code such as:

<<<<<<<<< HEAD

>>>>>>> dev-wip

Can anyone help me with why it is not rendering properly?

Janaka Dombawela
  • 1,337
  • 4
  • 26
  • 49

1 Answers1

1

This problem occurs because the file was modified during the time between before you pushed your code and after the last pull or clone that you took.

The <<<<<<< HEAD, ======= and >>>>>>> dev-wip constitutes one set of conflicts that git has seen. These are the markers that tell that the code above ======= has conflicts with the code below it.

To resolve, you should take a decision as to which lines of code you need to keep. To do that, analyze the code and see what changes are relevant and should be there in the final merge. After that decide remove these markers <<<<<<< HEAD, ======= and >>>>>>> and ensure your code is proper.

Steps to avoid this are:

  1. Review your code before merging and better before creating a pull request (PR)
  2. Try to take a git pull -r origin <branch_name> before pushing to the branch
Harshit Garg
  • 2,137
  • 21
  • 23