git 操作 (一)

git 配置

查看 git 全局配置

$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true

修改 git 全局名称

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git config --global user.name "qiankunpingtai"
qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git config --global user.email "qiankunpingtai@163.com"

提交示例 1

添加要提交的目录

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git add writecardtool/

设置提交说明

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git commit -m "修改同步任务pboss部分未获取码号详细信息的问题"

生成 change-id

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git commit --amend
[master 703db06] 修改同步任务pboss部分未获取码号详细信息的问题
 Date: Thu Oct 10 11:38:46 2019 +0800
 7 files changed, 110 insertions(+), 3 deletions(-)

忽略其他的文件

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git stash -u -k
warning: LF will be replaced by CRLF in 01芯片管理平台/06代码/01前端/chipsys/.idea/compiler.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01芯片管理平台/06代码/01前端/chipsys/.idea/inspectionProfiles/Project_Default.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in 01芯片管理平台/06代码/01前端/chipsys/.idea/qaplug_profiles.xml.
The file will have its original line endings in your working directory
Saved working directory and index state WIP on master: 703db06 修改同步任务pboss部分未获取码号详细信息的问题

rebase 链式提交

$ git pull --rebase
Current branch master is up to date.
#### 提交到服务器
qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)
$ git push origin master:refs/for/master

恢复忽略掉的文件

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/04空写联调平台/06代码 (master)
$ git stash pop
Auto-merging 01芯片管理平台/06代码/02后端/src/main/resources/config/config.properties
CONFLICT (content): Merge conflict in 01芯片管理平台/06代码/02后端/src/main/resources/config/config.properties
Auto-merging 01芯片管理平台/06代码/01前端/chipsys/public/js/super_stat.js
Auto-merging 01芯片管理平台/06代码/01前端/chipsys/config/env/development.js
CONFLICT (content): Merge conflict in 01芯片管理平台/06代码/01前端/chipsys/config/env/development.js
Removing 01芯片管理平台/06代码/01前端/chipsys/.idea/vcs.xml
The stash entry is kept in case you need it again.

把暂存区的修改撤销掉,重新放回工作区

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码 (master)
$ git reset HEAD  ./

提交示例 2

将 java 文件和 mapper 文件提交到缓存区

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git add  src/main/java/
qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git add src/main/resources/mappers/

忽略掉其他文件

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git stash -u -k

添加提交说明

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git commit -m "导出芯片未签收统计列表、写卡数据统计功能"
[master 4bc9f3d] 导出芯片未签收统计列表、写卡数据统计功能
 7 files changed, 314 insertions(+), 15 deletions(-)

生成 change-id

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git commit --amend
[master 8b6fe45] 导出芯片未签收统计列表、写卡数据统计功能
 Date: Thu Oct 10 14:28:59 2019 +0800
 7 files changed, 314 insertions(+), 15 deletions(-)

链式提交

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git pull --rebase
Current branch master is up to date.

提交到服务器

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git push origin master:refs/for/master
Enumerating objects: 78, done.
Counting objects: 100% (78/78), done.
Delta compression using up to 8 threads
Compressing objects: 100% (39/39), done.
Writing objects: 100% (43/43), 16.36 KiB | 1.09 MiB/s, done.
Total 43 (delta 28), reused 0 (delta 0)
remote: Resolving deltas: 100% (28/28)
remote: Processing changes: new: 1, done
remote:
remote: New Changes:
remote:   http://192.168.218.217:18080/#/c/xinpianguanli/+/568 导出芯片未签收统计列表、写卡数据统计功能
remote:
To ssh://192.168.218.217:29418/xinpianguanli
 * [new branch]      master -> refs/for/master

恢复忽略掉的文件

$  git stash pop
Removing 01芯片管理平台/06代码/01前端/chipsys/.idea/vcs.xml
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    "../01\345\211\215\347\253\257/chipsys/.idea/vcs.xml"
        modified:   "../01\345\211\215\347\253\257/chipsys/config/env/development.js"
        modified:   "../01\345\211\215\347\253\257/chipsys/public/js/super_stat.js"
        modified:   src/main/resources/config/application.properties
        modified:   src/main/resources/config/config.properties

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

        "../01\345\211\215\347\253\257/chipsys/.idea/compiler.xml"
        "../01\345\211\215\347\253\257/chipsys/.idea/dictionaries/"
        "../01\345\211\215\347\253\257/chipsys/.idea/inspectionProfiles/"
        "../01\345\211\215\347\253\257/chipsys/.idea/qaplug_profiles.xml"

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (8b69bd713d2eeb9c20cf95ed5a8af5150dec96a1)

多次提交缺少 changeid 的处理

重置到服务器版本

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)
$ git reset 9985add837c4b32b2f4ac8540eb31d15b45a52ad --hard
HEAD is now at 9985add 超时后重写成功写卡显示异常bug  增加物联网公司角色查看写卡结果搜索功能

提交本地已经提交的内容

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)
$ git cherry-pick 9c5e4905b590bd39f64b833017b3820f65668d38
[master 39c7cf8] 最新代码提交
 Date: Wed Sep 18 17:34:42 2019 +0800

生成 changeid

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)
$ git commit --amend
[master 8d8cc66] 最新代码提交
 Date: Wed Sep 18 17:34:42 2019 +0800

再次提交

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)
$ git cherry-pick b0cd4192d4e7520c632ade2e30fdab8e8a0bfa69
[master a53d17c]   修改文件提交
 Date: Wed Sep 18 17:45:59 2019 +0800
 24 files changed, 783 insertions(+), 268 deletions(-)
qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)

rebase 链式提交

$ git pull --rebase
Current branch master is up to date.

提交到服务器

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli (master)
$ git push origin master:refs/for/master

切换分支

查看远程分支

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/chipsystem_dev
  remotes/origin/master
  remotes/origin/refsformaster

新建分支并切换到指定分支

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git checkout -b dev origin/chipsystem_dev
error: Your local changes to the following files would be overwritten by checkout:
        01芯片管理平台/06代码/01前端/chipsys/config/env/development.js
        01芯片管理平台/06代码/02后端/src/main/resources/config/application.properties
        01芯片管理平台/06代码/02后端/src/main/resources/config/config.properties
Please commit your changes or stash them before you switch branches.
Aborting

提交自己本地分支到服务器

服务器不存在该分支自动创建

D:\test>git push origin test
warning: redirecting to https://gitlab.test.com/test-front.git/
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for test, visit:
remote:   https://gitlab.test.com/test-front/merge_requests/new?merge_request%5Bsource_branch%5D=test
remote:
To https://gitlab.test.com/test-front
 * [new branch]        test -> test

忽略本地其它文件

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git stash -u -k
Saved working directory and index state WIP on master: 734832c M2M 写卡文件同步

新建分支并切换到指定分支

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git checkout -b dev origin/chipsystem_dev
Checking out files: 100% (470/470), done.
Switched to a new branch 'dev'
Branch 'dev' set up to track remote branch 'chipsystem_dev' from 'origin'.

查看本地分支

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (master)
$ git branch
  dev
* master

切换到本地 master 分支

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (dev)
$  git checkout master
Checking out files: 100% (470/470), done.
Switched to branch 'master'
Your branch and 'origin/master' have diverged,
and have 4 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

切换到 dev 分支

qiankunpingtai@hp MINGW64 /d/chinamobile/xinpianguanli/01芯片管理平台/06代码/02后端 (dev)
$  git checkout dev
Checking out files: 100% (470/470), done.
Switched to branch 'master'
Your branch and 'origin/master' have diverged,
and have 4 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

从分支中删除指定提交

本地提交记录
D:\hf\test\test-backend>git log --oneline
190b3e8b (HEAD -> 20220113, origin/master, origin/HEAD, origin/20220113) Merge branch 'dev' into 'master'
caf3543c Merge branch 'feature/ch' into dev
66fd0e83 (master) Merge branch 'dev' into 'master'
c26c0048 (origin/feature/ch) 新增采方退货通知增加索引
d53b3eff 新增采方退货通知优化, 增加索引
ed8413a0 新增采方退货通知优化, 增加索引
fb7104df (dev) Merge branch 'fix-test-ld' into 'dev'
99f133c2 Merge branch 'dev-zk' into dev
42e285f3 (origin/dev-zk) 接口二添加错误提示
337b3cee Merge branch 'dev' into 'master'
bb821dd2 Merge branch 'feature/ch' into dev
8e6640f4 新增退货通知优化, 增加索引
删除 ed8413a0 和 42e285f3 提交

从最接近的一次提交 337b3cee 开始处理

D:\hf\test\test-backend>git rebase -i 337b3cee

图片.png

之后:wq 保存,再 git log 会发现想删的那一条 commit 没有了,把 commit 清到最初一次没有后续的 commit 之后再 git rebase -i 远端最后一次提交的 ID,就会成功了

删除后提交记录
D:\hf\test\v5-test-backend>git log --oneline
003029b6 (HEAD) fix:采购订单定时任务优化-变更添加图纸版本,税码
ecd6e269 fix:采购订单定时任务优化-订单明细行
337b3cee Merge branch 'dev' into 'master'
bb821dd2 Merge branch 'feature/ch' into dev
8e6640f4 新增退货通知优化, 增加索引
删除指定分支
D:\hf\test\test-backend>git branch --delete 20220113
warning: deleting branch '20220113' that has been merged to
         'refs/remotes/origin/master', but not yet merged to HEAD.
Deleted branch 20220113 (was 190b3e8b).
删除指定远程指定分支
D:\hf\test\test-backend>git push origin --delete release20230116
warning: redirecting to https://test-backend.git/
To https://test-backend
 - [deleted]           release20230116

配置公私钥

qiankunpingtai@hp MINGW64 /d/xinpianguanli_dev
$ cd ~/.ssh
qiankunpingtai@hp MINGW64 ~/.ssh
$ ls
$ ssh-keygen -t rsa -C "caijl@redoornetwork.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/qiankunpingtai/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/qiankunpingtai/.ssh/id_rsa.
Your public key has been saved in /c/Users/qiankunpingtai/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Q9OA9dziObY/CKoN9Jw0U/KnCjqfbwyCuHyDT3iKDHE caijl@redoornetwork.com
The key's randomart image is:
+---[RSA 2048]----+
|       oo        |
|      .  = .     |
|      . + = .    |
|       = o o     |
|o.E . + S *      |
|ooo..+ +.= o     |
|oo.+oo+.....     |
|=o=+ =+.  ...    |
|.o++=++     ..   |
+----[SHA256]-----+
qiankunpingtai@hp MINGW64 ~/.ssh
$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPV3W5QSsYwzx29 qiankunpingtai@redoornetwork.com

将如上公钥配置到 git 上

图片.png

remote: Unauthorized(只支持 ssh 不支持 http)

cjl@hp MINGW64 /d/xinpianguanli_dev
$ git config --global user.name "qiankunpingtai"
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git config --global user.email "qiankunpingtai@redoornetwork.com"
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone ssh://qiankunpingtai@192.168.218.217:29418/chipsystem_develop
Cloning into 'chipsystem_develop'...
The authenticity of host '[192.168.218.217]:29418 ([192.168.218.217]:29418)' can't be established.
RSA key fingerprint is SHA256:ZoGaLXCecK6HT0XDyYoWzFnE8dNhC+jL8+no28XuWcY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.218.217]:29418' (RSA) to the list of known hosts.
remote: Counting objects: 1330, done
remote: Finding sources: 100% (1330/1330)
remote: Total 1330 (delta 337), reused 1327 (delta 337)
Receiving objects: 100% (1330/1330), 18.43 MiB | 11.17 MiB/s, done.
Resolving deltas: 100% (337/337), done.
Checking out files: 100% (1206/1206), done.
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone ssh://qiankunpingtai@192.168.218.217:29418/chipsystem_develop
fatal: destination path 'chipsystem_develop' already exists and is not an empty directory.
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone ssh://qiankunpingtai@192.168.218.217:29418/chipsystem_develop
Cloning into 'chipsystem_develop'...
remote: Counting objects: 1330, done
remote: Finding sources: 100% (1330/1330)
remote: Total 1330 (delta 337), reused 1327 (delta 337)
Receiving objects: 100% (1330/1330), 18.43 MiB | 11.15 MiB/s, done.
Resolving deltas: 100% (337/337), done.
Checking out files: 100% (1206/1206), done.
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone ssh://qiankunpingtai@192.168.218.217:29418/chipsystem_develop && scp -p -P 29418 qiankunpingtai@192.168.218.217:hooks/commit-msg chipsystem_develop/.git/hooks/
Cloning into 'chipsystem_develop'...
remote: Counting objects: 1330, done
remote: Finding sources: 100% (1330/1330)
remote: Total 1330 (delta 337), reused 1327 (delta 337)
Receiving objects: 100% (1330/1330), 18.43 MiB | 11.16 MiB/s, done.
Resolving deltas: 100% (337/337), done.
Checking out files: 100% (1206/1206), done.
commit-msg                                                                                                                                                                                                                                   100% 4780   101.6KB/s   00:00
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git config --global user.name "qiankunpingtai1"
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git config --global user.email "qiankunpingtai@redoornetwork.com1"
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone ssh://qiankunpingtai@192.168.218.217:29418/chipsystem_develop && scp -p -P 29418 qiankunpingtai@192.168.218.217:hooks/commit-msg chipsystem_develop/.git/hooks/
Cloning into 'chipsystem_develop'...
remote: Counting objects: 1330, done
remote: Finding sources: 100% (1330/1330)
remote: Total 1330 (delta 337), reused 1327 (delta 337)
Receiving objects: 100% (1330/1330), 18.43 MiB | 11.22 MiB/s, done.
Resolving deltas: 100% (337/337), done.
Checking out files: 100% (1206/1206), done.
commit-msg                                                                                                                                                                                                                                   100% 4780    97.0KB/s   00:00
cjl@hp MINGW64 /d/xinpianguanli_dev
$  git clone http://192.168.218.217:18080/xinpianguanli && (cd xinpianguanli && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg http://192.168.218.217:18080/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
Cloning into 'xinpianguanli'...
remote: Unauthorized
fatal: Authentication failed for 'http://192.168.218.217:18080/xinpianguanli/'
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone http://192.168.218.217:18080/chipsystem_develop && (cd chipsystem_develop && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg http://192.168.218.217:18080/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
Cloning into 'chipsystem_develop'...
remote: Unauthorized
fatal: Authentication failed for 'http://192.168.218.217:18080/chipsystem_develop/'
cjl@hp MINGW64 /d/xinpianguanli_dev
$ git clone ssh://qiankunpingtai@192.168.218.217:29418/chipsystem_develop && scp -p -P 29418 qiankunpingtai@192.168.218.217:hooks/commit-msg chipsystem_develop/.git/hooks/
Cloning into 'chipsystem_develop'...
remote: Counting objects: 1330, done
remote: Finding sources: 100% (1330/1330)
remote: Total 1330 (delta 337), reused 1327 (delta 337)
Receiving objects: 100% (1330/1330), 18.43 MiB | 11.10 MiB/s, done.
Resolving deltas: 100% (337/337), done.
Checking out files: 100% (1206/1206), done.
commit-msg

从指定分支拉去最新代码

$ git pull < 远程库名 > < 远程分支名 >:< 本地分支名 >

cjl@hp MINGW64 /d/chipsystem_develop (master)
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev
  remotes/origin/master

cjl@hp MINGW64 /d/chipsystem_develop (master)
$ git pull origin dev:master
Already up to date.

设置本地分支与远程分支的关联

查看所有分支

cjl@hp MINGW64 /d/chipsystem_develop/06代码/02后端 (master)
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev
  remotes/origin/master

查看本地分支和远程分支的关联

本地 master 分支关联远程 master 分支

cjl@hp MINGW64 /d/chipsystem_develop/06代码/02后端 (master)
$ git branch -vv
* master 68c9146 [origin/master] 初始化

设置本地分支 master 和远程 dev 分支关联

cjl@hp MINGW64 /d/chipsystem_develop/06代码/02后端 (master)
$ git branch --set-upstream-to=origin/dev master
Branch 'master' set up to track remote branch 'dev' from 'origin'.

本地分支 master 和远程分支 dev 关联

cjl@hp MINGW64 /d/chipsystem_develop/06代码/02后端 (master)
$ git branch -vv
* master 68c9146 [origin/dev] 初始化

日志查看

git log 显示简略的提交日志

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git log
commit 734832c45242b5a9bcf311a7823fa408646fc0ea (HEAD -> master)
Author: qiankunpingtai <caijl@redoornetwork.com>
Date:   Fri Oct 18 16:43:24 2019 +0800

    M2M 写卡文件同步

    Change-Id: Ib0f3cf66028ad0f262cae4ee5ded35372304c62a

commit 4ca6694b3223d7d828032c6cc211f1952cecdabb
Author: caijulong <caijl@redoornetwork.com>
Date:   Thu Oct 10 14:46:20 2019 +0800

    客户行业分类优化

    Change-Id: Ia56760fc469eda43d15150f4a052b6b4eebe17aa

git log --stat 显示简要的增改行数统计

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git log --stat
commit 734832c45242b5a9bcf311a7823fa408646fc0ea (HEAD -> master)
Author: qiankunpingtai <caijl@redoornetwork.com>
Date:   Fri Oct 18 16:43:24 2019 +0800

    M2M 写卡文件同步

    Change-Id: Ib0f3cf66028ad0f262cae4ee5ded35372304c62a

 .../chinamobile/constant/BusinessConstants.java"   |   45 +
 .../com/chinamobile/constant/ConfigConstants.java" |   14 +-
 .../chinamobile/constant/ExceptionConstants.java"  |   49 +
 .../controller/WriteCardDataController.java"       |   76 ++
 .../dao/PhoneNumberInfoFromCtbossMapperExt.java"   |    5 +
 .../dao/WriteCardRecordsHistoryMapper.java"        |   30 +
 .../dao/WriteCardRecordsHistoryMapperExt.java"     |   10 +
 .../chinamobile/dao/WriteCardRecordsMapper.java"   |   30 +
 .../dao/WriteCardRecordsMapperExt.java"            |   21 +
 .../dao/WritecardProcessRecordMapperExt.java"      |    2 +
 .../chinamobile/dto/ToM2MWriteCardInfoDTO.java"    |   73 ++
 .../com/chinamobile/model/WriteCardRecords.java"   |  162 +++
 .../model/WriteCardRecordsExample.java"            | 1061 ++++++++++++++++++++
 .../model/WriteCardRecordsHistory.java"            |  162 +++
 .../model/WriteCardRecordsHistoryExample.java"     | 1061 ++++++++++++++++++++
 .../chinamobile/schedule/WriteCardDataSync.java"   |  444 ++++++++

git log -1 HEAD 示最后一次提交信息

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git log -1 HEAD
commit 734832c45242b5a9bcf311a7823fa408646fc0ea (HEAD -> master)
Author: qiankunpingtai <caijl@redoornetwork.com>
Date:   Fri Oct 18 16:43:24 2019 +0800

    M2M 写卡文件同步

    Change-Id: Ib0f3cf66028ad0f262cae4ee5ded35372304c62a

git log --pretty=oneline 单行显示日志信息

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git log --pretty=oneline
734832c45242b5a9bcf311a7823fa408646fc0ea (HEAD -> master) M2M 写卡文件同步
4ca6694b3223d7d828032c6cc211f1952cecdabb 客户行业分类优化
8b6fe45e736b1b4a641ca446c207286d40333f23 导出芯片未签收统计列表、写卡数据统计功能
437d49f93603981ea64736f2294495c520263049 修改同步任务pboss部分未获取码号详细信息的问题
f48f0df5b4cfc5c2e90c894d323a03541f93acb6 添加数据导入

git log --pretty=oneline --graph --abbrev-commit 查看图文格式日志

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git log --pretty=oneline --graph --abbrev-commit
* 734832c (HEAD -> master) M2M 写卡文件同步
* 4ca6694 客户行业分类优化
* 8b6fe45 导出芯片未签收统计列表、写卡数据统计功能
* 437d49f 修改同步任务pboss部分未获取码号详细信息的问题
* f48f0df 添加数据导入
* ee2a407 init internationalota
* e4a0592 修改LWM2M写卡组装onenet推送bug
* 70b8554 代码迁移redis配置修改、部分bug修复
* fb7654f 修改lwm2m sdk写卡上报不发送req异常,修改页面单张写卡imsi不查询异常

git log --graph --oneline --decorate --all 通过 ASCII 艺术的树形结构来展示所有的分支,每个分支都标示了他的名字和标签

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git log --graph --oneline --decorate --all
*-.   c399f4e (refs/stash) WIP on master: 734832c M2M 写卡文件同步
|\ \
| | * b8bcc3f untracked files on master: 734832c M2M 写卡文件同步
| * debd2a2 index on master: 734832c M2M 写卡文件同步
|/
* 734832c (HEAD -> master) M2M 写卡文件同步
* 4ca6694 客户行业分类优化
* 8b6fe45 导出芯片未签收统计列表、写卡数据统计功能
* 437d49f 修改同步任务pboss部分未获取码号详细信息的问题
| * 92edd17 (origin/master, origin/HEAD) 提交测试
| * 5136d91 添加cmiot临时号校验,修改部分bug
| * 2bf3b15 客户行业分类优化
| * 901b76c 导出芯片未签收统计列表、写卡数据统计功能
| * 8b8bcf8 修改同步任务pboss部分未获取码号详细信息的问题
|/

git reflog 显示所有提交,包括孤立节点

D:\chinamobile\xinpianguanli\01芯片管理平台\06代码\02后端>git reflog
734832c (HEAD -> master) HEAD@{0}: checkout: moving from dev to master
e3e7f20 (origin/chipsystem_dev, dev) HEAD@{1}: checkout: moving from master to dev
734832c (HEAD -> master) HEAD@{2}: checkout: moving from dev to master
e3e7f20 (origin/chipsystem_dev, dev) HEAD@{3}: reset: moving to HEAD
e3e7f20 (origin/chipsystem_dev, dev) HEAD@{4}: checkout: moving from master to dev
734832c (HEAD -> master) HEAD@{5}: reset: moving to HEAD
734832c (HEAD -> master) HEAD@{6}: commit (amend): M2M 写卡文件同步
f95f131 HEAD@{7}: commit: M2M 写卡文件同步
4ca6694 HEAD@{8}: reset: moving to HEAD
4ca6694 HEAD@{9}: commit (amend): 客户行业分类优化
33de7b0 HEAD@{10}: commit: 客户行业分类优化
8b6fe45 HEAD@{11}: reset: moving to HEAD
8b6fe45 HEAD@{12}: commit (amend): 导出芯片未签收统计列表、写卡数据统计功能
4bc9f3d HEAD@{13}: commit: 导出芯片未签收统计列表、写卡数

交给 idea 做版本控制

允许版本控制

1.png

使用 git 控制

2.png

查看版本日志

3.png

下一篇 git 操作 (二)