git Create branch via Command

很多時候都是使用BitBucket / Github 去create 新branch
但是久不久BitBucket 的 選擇 Branch的選項..總是選擇不到 UAT
最後選擇最原始既方法…
就是使用 command line 了

解決方法:

# 首先 checkout 了你想Create branch from 的 branch && git pull
git checkout uat && git pull
# 使用 git branch 來Create 新 branch
git branch [branch-name]
# checkout 新建立的branch
git checkout [branch-name]
# 用以下command push 去remote
git push --set-upstream origin [branch-name]

或者可以嘗試這樣..簡短一點

# git checkout -b [new branch name] [branch-from]
# e.g. 
git checkout -b [branch-name] uat

Hope you find it useful

Chi Yau
Chi Yau
Software Engineer

Interested on Learning new stuff and experience sharing