GitLab
  • Introduction
  • 初步了解
  • 安裝
  • 資料庫使用方式(postgreSQL)
  • 一些程式碼
  • Gitlab CI
  • Learn Git
    • Git 指令
    • 第一堂課 - 介紹git commit
    • 第二堂課 - git 的 branch
    • 第三堂課 - branch 以及 merge
    • 第四堂課 - git rebase
    • 第五堂課 - 在 git 中前後移動
    • 第六堂課 - 相對引用
    • 第七堂課 - "~" 符號
    • 第八關 - 取消 git 的修改
    • 第九堂課 - 移動 commit
Powered by GitBook
On this page
  • 破關提示:
  • 語法如下:

Was this helpful?

  1. Learn Git

第四堂課 - git rebase

rebasing是 merge branch 的第二種方法。rebasing 就是取出一連串的 commit,"複製"它們,然後把它們接在別的地方。

雖然聽起來難以理解,rebasing 的優點是可以建立更線性的 commit history。假如只允許使用 rebasing 的話,則我們的 repo 中的 commit log 或者是 commit history 會更加簡潔好看。

讓我們親身體會一下...

破關提示:

想完成這一關,執行以下操作:

  • 建立bugFixbranch

  • commit 一次

  • 切換回 master branch 再 commit 一次

  • 再次切換到 bugFix branch,接著 rebase bugFix 這個 branch 到 master branch 上

祝你好運啦!

語法如下:

git branch bugFix
git checkout bugFix
git commit
git checkout master
git commit
git checkout bugFix
git rebase master
Previous第三堂課 - branch 以及 mergeNext第五堂課 - 在 git 中前後移動

Last updated 5 years ago

Was this helpful?