Branch
Git branch
# List the branches
git branch
git branch -a
# Create new branch
git branch <branch-name>
git checkout <branch-name>
# Alternatively
git checkout -b <branch-name> <origin-name>
建立分支
# Clone 專案
git clone http://your.company.com/yourname/my_proj.git
cd my_proj
# 建立一個來源是 origin/main 的分支版,名稱為 test/util-cmd,並且切換(checkout)至分支版
git checkout -b test/util-cmd origin/main
git branch -a
# Change your codes
# 更新至本地專案庫
git add .
git commit -m "Added a new branch test/util-cmd"
# 上傳至遠端專案庫
git push --set-upstream origin test/util-cmd