Commit 4300cfbe authored by 王进波's avatar 王进波

update

parent 78e9061b
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Git 常用操作命令](#git-%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C%E5%91%BD%E4%BB%A4) - [Git 常用操作命令](#git-%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C%E5%91%BD%E4%BB%A4)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Git 常用操作命令 ## Git 常用操作命令
- `git init` - `git init`
......
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [创建新仓库](#%E5%88%9B%E5%BB%BA%E6%96%B0%E4%BB%93%E5%BA%93) - [创建新仓库](#%E5%88%9B%E5%BB%BA%E6%96%B0%E4%BB%93%E5%BA%93)
- [登录Web前端](#%E7%99%BB%E5%BD%95web%E5%89%8D%E7%AB%AF) - [登录Web前端](#%E7%99%BB%E5%BD%95web%E5%89%8D%E7%AB%AF)
- [新建项目](#%E6%96%B0%E5%BB%BA%E9%A1%B9%E7%9B%AE) - [新建项目](#%E6%96%B0%E5%BB%BA%E9%A1%B9%E7%9B%AE)
- [初始化本地仓库](#%E5%88%9D%E5%A7%8B%E5%8C%96%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93) - [初始化本地仓库](#%E5%88%9D%E5%A7%8B%E5%8C%96%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
## 创建新仓库 ## 创建新仓库
### 登录Web前端 ### 登录Web前端
...@@ -84,7 +84,7 @@ git config --global core.safecrlf true #打开安全crlf ...@@ -84,7 +84,7 @@ git config --global core.safecrlf true #打开安全crlf
然后,我们要将Web前端创建的远程仓库的Url添加到本地的origin标识中 然后,我们要将Web前端创建的远程仓库的Url添加到本地的origin标识中
```shell ```shell
git remote add origin https://civpub.vicp.net:8443/TestUse/test.git #这里我们默认使用https git remote add origin https://civgit.vicp.net:8443/TestUse/test.git #这里我们默认使用https
git remote #该命令检查本地配置的远程标识,可能存在多个远程url git remote #该命令检查本地配置的远程标识,可能存在多个远程url
git remote -v #查看当前远程url的详细信息 git remote -v #查看当前远程url的详细信息
``` ```
...@@ -103,7 +103,7 @@ git commit -m "initial commit" #提交暂存区中的修改,双引号内的内 ...@@ -103,7 +103,7 @@ git commit -m "initial commit" #提交暂存区中的修改,双引号内的内
![1533177035857](../../imgs/1533177035857.png) ![1533177035857](../../imgs/1533177035857.png)
```shell ```shell
git push origin master #将当前工作目录中的所有提交推送到远端仓库,origin指向了 https://civpub.vicp.net:8443/TestUse/test.git,master是新建仓库的默认分支,我们将代码提交到master分支 git push origin master #将当前工作目录中的所有提交推送到远端仓库,origin指向了 https://civgit.vicp.net:8443/TestUse/test.git,master是新建仓库的默认分支,我们将代码提交到master分支
#master 分支是默认受保护分支,执行push操作需要用户具有高于Developer的权限 #master 分支是默认受保护分支,执行push操作需要用户具有高于Developer的权限
``` ```
...@@ -113,7 +113,7 @@ Powershell中完整的输入输出如下 ...@@ -113,7 +113,7 @@ Powershell中完整的输入输出如下
PS F:\jekyllTest\mysite> git init PS F:\jekyllTest\mysite> git init
Initialized empty Git repository in F:/jekyllTest/mysite/.git/ Initialized empty Git repository in F:/jekyllTest/mysite/.git/
PS F:\jekyllTest\mysite> git remote PS F:\jekyllTest\mysite> git remote
PS F:\jekyllTest\mysite> git remote add origin https://civpub.vicp.net:8443/TestUse/test.git PS F:\jekyllTest\mysite> git remote add origin https://civgit.vicp.net:8443/TestUse/test.git
PS F:\jekyllTest\mysite> git remote PS F:\jekyllTest\mysite> git remote
origin origin
PS F:\jekyllTest\mysite> git add . PS F:\jekyllTest\mysite> git add .
...@@ -140,10 +140,10 @@ PS F:\jekyllTest\mysite> start . ...@@ -140,10 +140,10 @@ PS F:\jekyllTest\mysite> start .
PS F:\jekyllTest\mysite> git init PS F:\jekyllTest\mysite> git init
Initialized empty Git repository in F:/jekyllTest/mysite/.git/ Initialized empty Git repository in F:/jekyllTest/mysite/.git/
PS F:\jekyllTest\mysite> git remote -v PS F:\jekyllTest\mysite> git remote -v
PS F:\jekyllTest\mysite> git remote add origin https://civpub.vicp.net:8443/TestUse/test.git PS F:\jekyllTest\mysite> git remote add origin https://civgit.vicp.net:8443/TestUse/test.git
PS F:\jekyllTest\mysite> git remote -v PS F:\jekyllTest\mysite> git remote -v
origin https://civpub.vicp.net:8443/TestUse/test.git (fetch) origin https://civgit.vicp.net:8443/TestUse/test.git (fetch)
origin https://civpub.vicp.net:8443/TestUse/test.git (push) origin https://civgit.vicp.net:8443/TestUse/test.git (push)
PS F:\jekyllTest\mysite> git add . PS F:\jekyllTest\mysite> git add .
PS F:\jekyllTest\mysite> git status PS F:\jekyllTest\mysite> git status
On branch master On branch master
...@@ -193,9 +193,9 @@ Compressing objects: 100% (15/15), done. ...@@ -193,9 +193,9 @@ Compressing objects: 100% (15/15), done.
Writing objects: 100% (16/16), 41.37 KiB | 3.76 MiB/s, done. Writing objects: 100% (16/16), 41.37 KiB | 3.76 MiB/s, done.
Total 16 (delta 0), reused 0 (delta 0) Total 16 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to push code to protected branches on this project. remote: GitLab: You are not allowed to push code to protected branches on this project.
To https://civpub.vicp.net:8443/TestUse/test.git To https://civgit.vicp.net:8443/TestUse/test.git
! [remote rejected] master -> master (pre-receive hook declined) ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://civpub.vicp.net:8443/TestUse/test.git' error: failed to push some refs to 'https://civgit.vicp.net:8443/TestUse/test.git'
PS F:\jekyllTest\mysite> PS F:\jekyllTest\mysite>
#最后这里因为我用wangjinbo这个用户执行的push到master分支的操作,wangjinbo在test组的权限是developer,developer不允许向master推送提交 #最后这里因为我用wangjinbo这个用户执行的push到master分支的操作,wangjinbo在test组的权限是developer,developer不允许向master推送提交
``` ```
......
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [命令行演示常用操作](#%E5%91%BD%E4%BB%A4%E8%A1%8C%E6%BC%94%E7%A4%BA%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C) - [命令行演示常用操作](#%E5%91%BD%E4%BB%A4%E8%A1%8C%E6%BC%94%E7%A4%BA%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C)
- [git clone - 远程仓库](#git-clone---%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93) - [git clone - 远程仓库](#git-clone---%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93)
- [修改文档](#%E4%BF%AE%E6%94%B9%E6%96%87%E6%A1%A3) - [修改文档](#%E4%BF%AE%E6%94%B9%E6%96%87%E6%A1%A3)
- [git add - 添加修改到暂存区](#git-add---%E6%B7%BB%E5%8A%A0%E4%BF%AE%E6%94%B9%E5%88%B0%E6%9A%82%E5%AD%98%E5%8C%BA) - [git add - 添加修改到暂存区](#git-add---%E6%B7%BB%E5%8A%A0%E4%BF%AE%E6%94%B9%E5%88%B0%E6%9A%82%E5%AD%98%E5%8C%BA)
- [git commit - 提交暂存区地修改](#git-commit---%E6%8F%90%E4%BA%A4%E6%9A%82%E5%AD%98%E5%8C%BA%E5%9C%B0%E4%BF%AE%E6%94%B9) - [git commit - 提交暂存区地修改](#git-commit---%E6%8F%90%E4%BA%A4%E6%9A%82%E5%AD%98%E5%8C%BA%E5%9C%B0%E4%BF%AE%E6%94%B9)
- [git fetch - 拉取远程分支数据到本地](#git-fetch---%E6%8B%89%E5%8F%96%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E6%95%B0%E6%8D%AE%E5%88%B0%E6%9C%AC%E5%9C%B0) - [git fetch - 拉取远程分支数据到本地](#git-fetch---%E6%8B%89%E5%8F%96%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF%E6%95%B0%E6%8D%AE%E5%88%B0%E6%9C%AC%E5%9C%B0)
- [git pull - 取回并合并远程主机某个分支的更新到本地](#git-pull---%E5%8F%96%E5%9B%9E%E5%B9%B6%E5%90%88%E5%B9%B6%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E6%9F%90%E4%B8%AA%E5%88%86%E6%94%AF%E7%9A%84%E6%9B%B4%E6%96%B0%E5%88%B0%E6%9C%AC%E5%9C%B0) - [git pull - 取回并合并远程主机某个分支的更新到本地](#git-pull---%E5%8F%96%E5%9B%9E%E5%B9%B6%E5%90%88%E5%B9%B6%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E6%9F%90%E4%B8%AA%E5%88%86%E6%94%AF%E7%9A%84%E6%9B%B4%E6%96%B0%E5%88%B0%E6%9C%AC%E5%9C%B0)
- [高级特性](#%E9%AB%98%E7%BA%A7%E7%89%B9%E6%80%A7) - [高级特性](#%E9%AB%98%E7%BA%A7%E7%89%B9%E6%80%A7)
- [git push - 推送本地提交到远程分支](#git-push---%E6%8E%A8%E9%80%81%E6%9C%AC%E5%9C%B0%E6%8F%90%E4%BA%A4%E5%88%B0%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF) - [git push - 推送本地提交到远程分支](#git-push---%E6%8E%A8%E9%80%81%E6%9C%AC%E5%9C%B0%E6%8F%90%E4%BA%A4%E5%88%B0%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF)
- [](#) - [](#)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
## 命令行演示常用操作 ## 命令行演示常用操作
### git clone - 远程仓库 ### git clone - 远程仓库
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
```shell ```shell
cd /d E:\Codes\City #我们先用CMD命令行的CD命令导航到我们习惯存放代码的路径下 cd /d E:\Codes\City #我们先用CMD命令行的CD命令导航到我们习惯存放代码的路径下
git clone https://civpub.vicp.net:8443/TestUse/test.git CityTest #clone远程仓库 git clone https://civgit.vicp.net:8443/TestUse/test.git CityTest #clone远程仓库
``` ```
![1533178094362](../../imgs/1533178094362.png) ![1533178094362](../../imgs/1533178094362.png)
......
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Git 账号](#git-%E8%B4%A6%E5%8F%B7) - [Git 账号](#git-%E8%B4%A6%E5%8F%B7)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Git 账号 ## Git 账号
GitlabServer: http://civpub.vicp.net:8880 GitlabServer: http://civgit.vicp.net:8880
推荐的两处学习资源 推荐的两处学习资源
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
edit-by:王进波 2018.08 edit-by:王进波 2018.08
- [安装Git-Windows](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/InstallGitWindows.md) - [安装Git-Windows](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/InstallGitWindows.md)
- [安装TotoiseGit](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/InstallTotoiseGit.md) - [安装TotoiseGit](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/InstallTotoiseGit.md)
- [Git 常用操作命令](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/CommenCmd.md) - [Git 常用操作命令](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/CommenCmd.md)
- [Git 账号与学习资料](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/GitlabAccount.md) - [Git 账号与学习资料](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/GitlabAccount.md)
- [创建新仓库](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/CreateNewRepository.md) - [创建新仓库](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/CreateNewRepository.md)
- [命令行演示常用操作](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/DemonstrateInCmd.md) - [命令行演示常用操作](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/DemonstrateInCmd.md)
- [图形界面的Git - SourceTree](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/DemonstrateInSourceTree.md) - [图形界面的Git - SourceTree](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/doc/FromSVNToGit/DemonstrateInSourceTree.md)
...@@ -188,7 +188,7 @@ Zabbix监控服务有一个可配置的Web前端,发布在http://192.168.12.1: ...@@ -188,7 +188,7 @@ Zabbix监控服务有一个可配置的Web前端,发布在http://192.168.12.1:
### 监控模板 ### 监控模板
监控模板可以导入导出,我导出的模板文件在 [这里](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/%E5%B7%A5%E5%85%B7/zbx_export_templates.xml)。 下载后在导入界面导入即可,导入成功后还需要增加一项监控项原型。 监控模板可以导入导出,我导出的模板文件在 [这里](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/%E5%B7%A5%E5%85%B7/zbx_export_templates.xml)。 下载后在导入界面导入即可,导入成功后还需要增加一项监控项原型。
Configuration - Template - Template OS Windows Wohi - Discovery roles - Network interface discovery - item prototypes,如图 Configuration - Template - Template OS Windows Wohi - Discovery roles - Network interface discovery - item prototypes,如图
......
...@@ -21,7 +21,7 @@ edit-by:王进波 2018.08.06 ...@@ -21,7 +21,7 @@ edit-by:王进波 2018.08.06
## 检查新增分组和代码 ## 检查新增分组和代码
打开Gitlab网页:http://civpub.vicp.net:8880 进入CivDevelop分组 打开Gitlab网页:http://civgit.vicp.net:8880 进入CivDevelop分组
## 签出CityWebService和Web4 ## 签出CityWebService和Web4
...@@ -33,7 +33,7 @@ edit-by:王进波 2018.08.06 ...@@ -33,7 +33,7 @@ edit-by:王进波 2018.08.06
检出CityWebService后端代码 检出CityWebService后端代码
```shell ```shell
git clone -b develop https://civpub.vicp.net:8443/CivDevelope/CityWebService.git #检出develop分支 git clone -b develop https://civgit.vicp.net:8443/CivDevelope/CityWebService.git #检出develop分支
cd CityWebService cd CityWebService
git branch #查看本地当前分支,是develop git branch #查看本地当前分支,是develop
git branch -a #查看本地和远程的全部分支 git branch -a #查看本地和远程的全部分支
...@@ -42,7 +42,7 @@ git branch -a #查看本地和远程的全部分支 ...@@ -42,7 +42,7 @@ git branch -a #查看本地和远程的全部分支
检出Web4前端代码 检出Web4前端代码
```shell ```shell
git clone -b develop https://civpub.vicp.net:8443/CivDevelope/Web4.git git clone -b develop https://civgit.vicp.net:8443/CivDevelope/Web4.git
cd Web4 cd Web4
git branch git branch
git branch -a git branch -a
...@@ -74,9 +74,9 @@ git branch #检查当前所在分支 ...@@ -74,9 +74,9 @@ git branch #检查当前所在分支
## 同步修改 ## 同步修改
[BeyondCompare](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/%E5%B7%A5%E5%85%B7/Beyond%20CompareHA.7z)工具对比自己本地代码和从Gitlab clone下来的代码,将本机的改动手动更新到本地Git working copy [BeyondCompare](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/%E5%B7%A5%E5%85%B7/Beyond%20CompareHA.7z)工具对比自己本地代码和从Gitlab clone下来的代码,将本机的改动手动更新到本地Git working copy
BeyondCompare工具我在本项目的工具文件夹中上传了,需要的可以自己[下载](https://civpub.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/%E5%B7%A5%E5%85%B7/Beyond%20CompareHA.7z),或者去网上找 BeyondCompare工具我在本项目的工具文件夹中上传了,需要的可以自己[下载](https://civgit.vicp.net:8443/wangjinbo/Svn-to-Git/blob/master/%E5%B7%A5%E5%85%B7/Beyond%20CompareHA.7z),或者去网上找
> 在这步操作过程中,我们优先同步自己修改的代码部分,对于代码内容存在差异的,如果是我们自己改的,能够判断哪边最新,就可以手动同步,如果不是我们修改的,不能判断的情况下,保留原样,不做修改,以Git目录为准就可以了 > 在这步操作过程中,我们优先同步自己修改的代码部分,对于代码内容存在差异的,如果是我们自己改的,能够判断哪边最新,就可以手动同步,如果不是我们修改的,不能判断的情况下,保留原样,不做修改,以Git目录为准就可以了
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment