> For the complete documentation index, see [llms.txt](https://tobyisme.gitbook.io/gitlab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tobyisme.gitbook.io/gitlab/learn-git/di-liu-tang-ke-xiang-dui-yin-yong.md).

# 第六堂課 - 相對引用

如果要在 git 中移動，透過指定 commit 的 hash 值的方式會變得比較麻煩。在實際例子中，你的終端機上面不會出現漂亮且具備視覺效果的 commit tree，所以你不得不用`git log`來查詢 hash 值。

另外，hash 值的長度在真實的 git 環境中很長。舉個例子，前一個關卡的介紹中的 commit 的 hash 值是`fed2da64c0efc5293610bdd892f82a58e8cbc5d8`。舌頭不要打結了...

幸運的是，git 對於處理 hash 值很有一套。你只需要提供能夠唯一辨識出該 commit 的前幾個字元就可以了。所以，我可以只輸入`fed2`而不是上面的一長串字元。

## 破關提示：

要完成這一關，切換到`bugFix`的 parent commit。這會分離出`HEAD`。

如果你願意的話，透過直接指定 hash 值的方式也可以過關，但是還是試試看相對引用吧！

## 語法如下：

```
git checkout C4
git checkout HEAD^
```
