【问题标题】:Git for Production got messed up with merging error用于生产的 Git 因合并错误而搞砸了
【发布时间】:2017-07-06 04:12:03
【问题描述】:

我在生产中的 node_modules 被另一台具有不同 node_modules 的本地机器弄乱了。现在每当I git pull origin master 生产时,都会显示以下消息:

ubuntu@ip-:~/proj$ git pull origin master
Enter passphrase for key '/home/ubuntu/.ssh/id_rsa':
From bitbucket.org:laics/proj
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
        node_modules/gulp-autoprefixer/package.json
        node_modules/gulp-complexity/package.json
        node_modules/gulp-concat/package.json
        node_modules/gulp-cssnano/node_modules/object-assign/package.json
        node_modules/gulp-cssnano/package.json
        node_modules/gulp-jsvalidate/node_modules/.bin/esparse
        node_modules/gulp-jsvalidate/node_modules/.bin/esvalidate
        node_modules/gulp-jsvalidate/node_modules/esprima/package.json
        node_modules/gulp-jsvalidate/package.json
        node_modules/gulp-less/node_modules/object-assign/package.json
        node_modules/gulp-less/package.json
        node_modules/gulp-ng-annotate/package.json
        node_modules/gulp-notify/package.json
        node_modules/gulp-rename/package.json
        .........
        node_modules/gulp-shell/node_modules/lodash/isEmpty.js
        node_modules/gulp-shell/node_modules/lodash/isError.js
        node_modules/gulp-shell/node_modules/lodash/isFunction.js
        node_modules/gulp-shell/node_modules/lo
   Aborting

最终我要更新的文件没有更新。

【问题讨论】:

    标签: git bitbucket git-pull


    【解决方案1】:

    问题是您不应该签入node_modules 文件夹。否则你就有这个问题。通常,您的服务器上有一个脚本,可以在您的服务器上运行该命令。

    所以删除 node_modules 文件夹

    git rm --cached node_modules/
    

    然后它从 repo 中删除,但仍然在您的计算机上本地。然后将它放到您的.gitignore 并编写一个脚本,该脚本在您推送一些更改或使用部署系统部署更改时运行安装命令。

    【讨论】:

      猜你喜欢
      • 2022-01-05
      • 2021-01-25
      • 1970-01-01
      • 2016-09-17
      • 1970-01-01
      • 2020-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多