Git:命令:修订间差异
imported>Soleverlee 无编辑摘要 |
imported>Soleverlee |
||
第24行: | 第24行: | ||
=COMMIT记录= | =COMMIT记录= | ||
<source lang="bash"> | <source lang="bash"> | ||
git log | git log #查看提交记录 | ||
git | git commit --amend #修改上一次提交日志 | ||
</source> | </source> | ||
如果需要修改多次提交记录,或者合并commit,则 | |||
<source lang="bash"> | |||
git rebase -i HEAF~6 | |||
</source> | |||
进入编辑界面: | |||
<pre> | |||
pick f50ebb6 added a secondary datasource, *** THIS MAY AFFECT PROD ENV ***, and added multi-production category service | |||
2 pick 2bed616 updated dmp category response | |||
3 pick 879693f added category filter | |||
4 pick 284c5a6 added another category detail api for multi-product business | |||
5 pick 0121db1 fixed a bug where category names is not correct in category det ail api | |||
6 pick 24ccf25 NEG-2529: (lihaifeng) updated category detail api | |||
7 | |||
8 # Rebase 4c79356..24ccf25 onto 4c79356 (6 commands) | |||
9 # | |||
10 # Commands: | |||
11 # p, pick = use commit | |||
12 # r, reword = use commit, but edit the commit message | |||
13 # e, edit = use commit, but stop for amending | |||
14 # s, squash = use commit, but meld into previous commit | |||
15 # f, fixup = like "squash", but discard this commit's log message | |||
16 # x, exec = run command (the rest of the line) using shell | |||
17 # d, drop = remove commit | |||
18 # | |||
19 # These lines can be re-ordered; they are executed from top to bottom. | |||
20 # | |||
21 # If you remove a line here THAT COMMIT WILL BE LOST. | |||
22 # | |||
23 # However, if you remove everything, the rebase will be aborted. | |||
24 # | |||
25 # Note that empty commits are commented out | |||
</pre> | |||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2017年5月22日 (一) 03:19的版本
=Fork/工作流 在使用git fork了其他人的项目后,这个项目就会在自己的git空间复制出来,这时如果人家的版本更新了怎么办?
git clone https://git.oschina.net/solee-linux/eova.git
cd eova
git remote add eova-master https://git.oschina.net/eova/eova.git
git fetch eova-master
git pull eova-master master
git fetch origin master:tmp
git diff tmp
git merge tmp
pull=fetch+merge
分支操作
git branch new-branch
git checkout new-branch
#以上两个命令等同于
git checkout -b new-branch
COMMIT记录
git log #查看提交记录
git commit --amend #修改上一次提交日志
如果需要修改多次提交记录,或者合并commit,则
git rebase -i HEAF~6
进入编辑界面:
pick f50ebb6 added a secondary datasource, *** THIS MAY AFFECT PROD ENV ***, and added multi-production category service 2 pick 2bed616 updated dmp category response 3 pick 879693f added category filter 4 pick 284c5a6 added another category detail api for multi-product business 5 pick 0121db1 fixed a bug where category names is not correct in category det ail api 6 pick 24ccf25 NEG-2529: (lihaifeng) updated category detail api 7 8 # Rebase 4c79356..24ccf25 onto 4c79356 (6 commands) 9 # 10 # Commands: 11 # p, pick = use commit 12 # r, reword = use commit, but edit the commit message 13 # e, edit = use commit, but stop for amending 14 # s, squash = use commit, but meld into previous commit 15 # f, fixup = like "squash", but discard this commit's log message 16 # x, exec = run command (the rest of the line) using shell 17 # d, drop = remove commit 18 # 19 # These lines can be re-ordered; they are executed from top to bottom. 20 # 21 # If you remove a line here THAT COMMIT WILL BE LOST. 22 # 23 # However, if you remove everything, the rebase will be aborted. 24 # 25 # Note that empty commits are commented out