# 第四堂課 - git rebase

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

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

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

## 破關提示：

想完成這一關，執行以下操作：

* 建立`bugFix`branch
* 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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tobyisme.gitbook.io/gitlab/learn-git/di-si-tang-ke-git-rebase.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
