github常見指令

摘要:github常見指令

github常見指令
================================
切到專案下執行
 
有衝突時:git mergetool
 

Git fetch remote branch

git branch -r
origin/HEAD -> origin/master
origin/daves_branch
origin/discover
origin/master

git fetch origin discover
git checkout discover

 

 

 
::第一次將該專案加入remote=upstream
git remote add upstream https://github.com/ChunghwaTelecom/cht-commons.git
 
::列出該專案所有remote與origin master與branch
git branch -a
下載該branch至local
::git checkout -b remotes/origin/xxx_branch

--當有人改了你的branch時
git fetch origin
git reset --hard origin/xxxx(branch_name)
 
--切換到另一個 branc
git checkout branch名稱 
 
//強制push to origin
git push --force origin xxxx_xxx(branch_name)
 
 
 
參考網 址:http://blog.longwin.com.tw/2009/05/git-learn-initial-command-2009/
 

抓取 / 切換 Repository 的 branch

  • git fetch origin
  • git checkout --track -b reps-branch origin/reps-branch # 抓取 reps-branch, 並將此 branch 建立於 local 的 reps-branch