git rebase

Posted 苏轶然

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git rebase相关的知识,希望对你有一定的参考价值。

  1 noop
  2 
  3 # Rebase 3bb2bfb..3bb2bfb onto 3bb2bfb (1 command)
  4 #
  5 # Commands:
  6 # p, pick = use commit
  7 # r, reword = use commit, but edit the commit message
  8 # e, edit = use commit, but stop for amending
  9 # s, squash = use commit, but meld into previous commit
 10 # f, fixup = like "squash", but discard this commit‘s log message
 11 # x, exec = run command (the rest of the line) using shell
 12 # d, drop = remove commit
 13 #
 14 # These lines can be re-ordered; they are executed from top to bottom.
 15 #
 16 # If you remove a line here THAT COMMIT WILL BE LOST.
 17 #
 18 # However, if you remove everything, the rebase will be aborted.
 19 #
 20 # Note that empty commits are commented out
~                                                                                                                                      
~                                                                                                                                      
~                                                                                                                                      
~                                                                                                                                      
~                                                                                                                                      
~                          

这是git rebase任选的文件,前面是系统已有提交将要对git rebase -i ${commitID}中commitID代表的操作进行的下一步修改。上面的内容表示当前分支的最新提交,故所做操作为noop。文件中部分帮助内容在文件下半部分给出。代表的内容是git默认的帮助内容。也是rebase可以进行的操作。

 

 

 

此下为当前分之中较早的一次提交。其中包含了多重操作,若需要对不同分支进行调整,修改pick为对应关键词即可。建议一次一次修改哈~

 

随后提交push到远端时,会对远端分支进行变基,先前的提交会被修改后的提交覆盖。

  1 pick 1641665 w2v model utils.
  2 pick 05f81c5 WIP:w2v model train.
  3 pick 67c986e remote maven compile Error fixed.
  4 pick 7af70e6 WIP:remote maven compile Error fixed.
  5 pick d8ad75f WIP:Utils staging.
  6 pick f10875e WIP:word2vec训练完成,模型生成完成。
  7 pick 45de2bd CLN:代码引用Utils区分私有包和dataflow公有包。
  8 pick 0d5db19 BUG:Fix set windowSize failure.
  9 pick d267a86 WIP:Export Json result.
 10 pick 3bb2bfb BUG:Fix git pipeline compile Error.
 11 
 12 # Rebase debd030..3bb2bfb onto debd030 (10 commands)
 13 #
 14 # Commands:
 15 # p, pick = use commit
 16 # r, reword = use commit, but edit the commit message
 17 # e, edit = use commit, but stop for amending
 18 # s, squash = use commit, but meld into previous commit
 19 # f, fixup = like "squash", but discard this commit‘s log message
 20 # x, exec = run command (the rest of the line) using shell
 21 # d, drop = remove commit
 22 #
 23 # These lines can be re-ordered; they are executed from top to bottom.
 24 #
 25 # If you remove a line here THAT COMMIT WILL BE LOST.
 26 #
 27 # However, if you remove everything, the rebase will be aborted.
 28 #
 29 # Note that empty commits are commented out
~                                                                                                                                      
~                                                                                                                                      
~        

 

以上是关于git rebase的主要内容,如果未能解决你的问题,请参考以下文章

合并代码还在用 git merge?我们都用 git rebase

git commit前必须rebase吗

git rebase 压缩提交

git rebase 使用总结

找回git rebase --skip消失的代码

git 通过rebase的方式 提交代码