Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Git 中使用分支
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

如何在 Git 中使用分支

本教程的前面章節介紹如何設定 Git、建立和克隆儲存庫、提交和拉取更改等。不管您是否隨著教程內容,在 Windows, MacCommand Line 中使用 Git,您現在已經準備好可以學習分支內容了。

如果您錯過了我們對分支的介紹,您可以在此處重新溫習該內容

如果您還沒有,請創建一個名為tutorial的新目錄,並使用 git init 指令初始化一個 Git 儲存庫。

$ mkdir tutorial
$ cd tutorial
$ git init
Initialized empty Git repository in /Users/username/Desktop/tutorial/.git/

然後在tutorial目錄中建立一個名為myfile.txt的新檔案,內容如下,並提交更改。

Anyone can learn Git with this tutorial and Backlog
$ git add myfile.txt
$ git commit -m "first commit"
[main (root-commit) a73ae49] first commit
  1 files changed, 1 insertions(+), 0 deletions(-)
    create mode 100644 myfile.txt

此時,我們的歷史紀錄看起來是這樣的。

Current history

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life