Git:命令:修订间差异

来自WHY42
imported>Soleverlee
imported>Soleverlee
无编辑摘要
第33行: 第33行:
进入编辑界面:
进入编辑界面:
<pre>
<pre>
pick f50ebb6 added a secondary datasource, *** THIS MAY AFFECT PROD ENV ***,    and added multi-production category service
  1 pick f50ebb6 added a secondary datasource, *** THIS MAY AFFECT PROD ENV ***,    and added multi-production category service
   2 pick 2bed616 updated dmp category response
   2 pick 2bed616 updated dmp category response
   3 pick 879693f added category filter
   3 pick 879693f added category filter
第50行: 第50行:
  16 # x, exec = run command (the rest of the line) using shell
  16 # x, exec = run command (the rest of the line) using shell
  17 # d, drop = remove commit
  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>
</pre>
[[Category:Linux/Unix]]
[[Category:Linux/Unix]]

2017年5月22日 (一) 03:26的版本

=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

进入编辑界面:

  1 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