美文网首页
gitlab排查问题及下拉上传

gitlab排查问题及下拉上传

作者: 宇宙小神特别萌 | 来源:发表于2019-01-09 14:38 被阅读25次

    zja-fix: 是本地开发仓库
    dev:是本地暂存区仓库,下拉和上传项目都是从此仓库
    master:本地的主仓库
    origin/dev:是远程的仓库,是origin/master的分支仓库
    origin/master:是远程主仓库

    根据上一篇,下把项目下来下来,进入项目文件夹,右击,选择Git Bash Here,如果没有就下载软件安装。


    进入Git Bash Here

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (zja-fix)

    查看本仓库的文件状态

    $ git status
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (zja-fix)

    切换仓库

    $ git checkout dev
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    查看对比两次文件内容具体修改了什么

    $ git diff origin/dev
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    查看提交日志

    $ git log
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    下拉更新项目

    $ git pull
    

    错误:合并将覆盖对以下文件的本地更改:

    error: Your local changes to the following files would be overwritten by merge:
    data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190103 data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190104 dgpommb-server-service/src/main/resources/application.yml dgpoms-server-imsservice/src/main/resources/application.yml dgpoms-server-omsservice/src/main/resources/application-dev.yml dgpoms-server-omsservice/src/main/resources/application.yml

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    切换分支

    $ git checkout zja-fix
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (zja-fix)

    查看状态

    $ git status
    

    On branch zja-fix
    Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)

    new file: data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190103
    new file: data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190104
    modified: dgpommb-server-service/src/main/resources/application.yml
    modified: dgpoms-server-imsservice/src/main/resources/application.yml
    modified: dgpoms-server-omsservice/src/main/resources/application-dev.yml
    modified: dgpoms-server-omsservice/src/main/resources/application.yml

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (zja-fix)

    撤销操作:从版本库中 拉取文件到 暂存区 当我们把工作区的某个文件弄乱了 我们就可以使用该命令 把版本库中的那个文件拉到暂存区 然后在拉回工作区

    $ git reset HEAD data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190103
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (zja-fix)

    $ git status
    

    On branch zja-fix
    Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)

    new file: data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190104

    modified: dgpommb-server-service/src/main/resources/application.yml
    modified: dgpoms-server-imsservice/src/main/resources/application.yml
    modified: dgpoms-server-omsservice/src/main/resources/application-dev.yml
    modified: dgpoms-server-omsservice/src/main/resources/application.yml

    Untracked files:
    (use "git add <file>..." to include in what will be committed)

    data/dist/log/project.artifactId_IS_UNDEFINED/project.artifactId_IS_UNDEFINED_detail.log.20190103

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (zja-fix)

    $ git checkout dev
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    $ git pull
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    $ git status
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    $ git log
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    合并分支:将zja-fix分支合并到本分支dev

    $ git merge zja-fix
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    $ git log
    

    Administrator@ZhengJiaAo MINGW64 /j/ZhengJiaAo/dgpoms-server-root (dev)

    $ git push
    

    相关文章

      网友评论

          本文标题:gitlab排查问题及下拉上传

          本文链接:https://www.haomeiwen.com/subject/lyfgrqtx.html