Git的使用
git pull 出現如下錯誤:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> test
- 原因:本地的分支沒有和遠程分支建立追蹤關系
- git提示:你需要建立跟蹤分支
- 使用命令:
git branch --set-upstream-to=origin/<branch> test
<branch>
是你的遠程分支名稱
- 新建本地分支:git branch 分支名
- 切換分支:git checkout 分支名
- 查看所有分支:git branch -a
- 刪除分支:git branch -d 分支名
- 推送本地分支:git push origin 本地分支:遠程分支
- 本地分支必須為你本地存在的分支
- 如果遠程分支不存在則會自動創建分支。
- 刪除遠程分支:Git push origin :遠程分支
git pull 的出現如下錯誤:
Your local changes to the following files would be overwritten by merge
- 本地的代碼和服務器代碼發生沖突:
- 兩者合並
- git stash
- git pull
- git stash pop
- 代碼庫覆蓋本地:
- git reset --hard
- git pull
- 兩者合並