在 gitlab 代码上同步后无法编译并且在文件中没有显示错误但在网页上显示错误

After sync on gitlab code unable to compile and show no error in files but on webpage

网页上显示的错误- 编译失败

src/pages/Adminstration/IdentityAccess/CreateUserType.jsx
Syntax error: Unexpected token (31:2)

  29 |           <main>
  30 |             <div className="container">
> 31 | <<<<<<< HEAD:src/web/src/pages/Adminstration/IdentityAccess/NewUserType.jsx
       |  ^
  32 |               <Breadcrumb {...{ context: "MANAGE_USERTYPES", leaf: "New User Type" }} />
  33 | =======
  34 |               <Breadcrumb {...{ context: "MANAGE_USER_TYPES", leaf: "new User Types" }} />

当我检查文件中的代码时,它是-

import React, { Component } from "react";
import { Header, Sidebar, Breadcrumb } from "../../../components";
import { startLoading, stopLoading } from "../../../components/Util";
import Select from "react-select";

class CreateUserType extends Component {
  constructor(props) {
    super();
    this.state = {
      loaded: true,
    };
  }

  componentDidMount() {
    document.title = "LIMS - Create User Types ";
  }

  upsert() {
    console.log("TBD....");
  }

  render() {
    !this.state.loaded ? startLoading() : stopLoading();
    return (
      this.state.loaded && (
        <div>
          <Header />
          <Sidebar context="USER_TYPES" />
          <main>
            <div className="container">
            <Breadcrumb {...{ context: "MANAGE_USERTYPES", leaf: "New User Type" }} />
              <h5 className="subtitle is-3">User Type</h5>
              <hr />

有人将文件名从 NewUserType.js 更改为 CreateUserType 所以我到处都更改了文件名。

这是 git merge 失败的结果,这是 Git 更新本地存储库时的默认策略。如果你看到这个,说明文件中有冲突,它总是一个固定的格式:

<<<<<<<====== 开头的行之间的一行(或多行)是您在存储库的本地副本中已有的内容(HEAD 指向您当前的分支或提交):

> 31 | <<<<<<< HEAD:src/web/src/pages/Adminstration/IdentityAccess/NewUserType.jsx
       |  ^
  32 |               <Breadcrumb {...{ context: "MANAGE_USERTYPES", leaf: "New User Type" }} />
  33 | =======

=======>>>>>>> 开头的行之间的一行(或多行)是从远程存储库(您 git pull 来自的地方)提取的内容,与Git 预计在您的文件中:

  33 | =======
  34 |               <Breadcrumb {...{ context: "MANAGE_USER_TYPES", leaf: "new User Types" }} />
  35 | >>>>>>>

您应该选择与您的项目(或多个项目)最相关的文件,并确保在执行 git pull(google for git stash 了解相关信息)