Git rebase

作者: JaedenKil | 来源:发表于2019-03-14 19:29 被阅读0次
user@PC0T9SND MINGW64 /c/Projects/AS_Project/GitDemo (master)
$ git log --oneline
0e2d274 (HEAD -> master) Add file03
445cb1c (dev) Add file02
c3cab12 Add file01
user@PC0T9SND MINGW64 /c/Projects/AS_Project/GitDemo (dev)
$ git log --oneline
6b1bae9 (HEAD -> dev) Add file04
445cb1c Add file02
c3cab12 Add file01

Now I have a repo:

  • Branch master: A - B - C
  • Branch dev: A - B - D

Scenario 1:

user@PC0T9SND MINGW64 /c/Projects/AS_Project/GitDemo (master)
$ git rebase dev master
First, rewinding head to replay your work on top of it...
Applying: Add file03
user@PC0T9SND MINGW64 /c/Projects/AS_Project/GitDemo (master)
$ git log --oneline
2ce7588 (HEAD -> master) Add file03
6b1bae9 (dev) Add file04
445cb1c Add file02
c3cab12 Add file01

Now I have a repo:

  • Branch master: A - B - D' - C
  • Branch dev: A - B - D
To 'undo rebase', use 'git reflog && git reset --hard id'.

Scenario 2:

user@PC0T9SND MINGW64 /c/Projects/AS_Project/GitDemo (dev)
$ git rebase master dev
First, rewinding head to replay your work on top of it...
Applying: Add file04
user@PC0T9SND MINGW64 /c/Projects/AS_Project/GitDemo (dev)
$ git log --oneline
29d899d (HEAD -> dev) Add file04
0e2d274 (master) Add file03
445cb1c Add file02
c3cab12 Add file01

Now I have a repo:

  • Branch master: A - B - C
  • Branch dev: A - B - C' - D

相关文章

网友评论

    本文标题:Git rebase

    本文链接:https://www.haomeiwen.com/subject/cdacmqtx.html