EKsumic's Blog

let today = new Beginning();

Click the left button to use the catalog.

OR

GitBash關於Branch的操作

查看當前既存分支

git branch

 

切換到你想去的分支

git checkout [分支名]

 

更改分支名字

git branch -m [目標分支] [更名后分支]

 

創建新分支:

git branch 新分支名稱

用你想要的新分支名稱替換新分支名稱。

 


簡化方法:切換並同時創建新分支

git checkout -b 新分支名稱

在Git中,分支的數量實際上是沒有嚴格限制的。你可以根據需要創建任意多的分支。

 

 

設置或更改上游分支

如果已經有本地分支並且需要設置或更改其上游分支,可以使用以下命令:

git branch --set-upstream-to=origin/feature-branch

這會將當前本地分支的上游分支設置為origin/feature-branch。

 

 

→上一篇:GitBash關於Remote的操作

→下一篇:GitBash關於使用Git查看當前狀態的操作

→返回目錄:GitBash使用手冊

This article was last edited at 2024-07-11 09:12:40

* *