Git pull 出现的错误

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
posted @ 2017-06-02 21:51  青柚  阅读(4483)  评论(0编辑  收藏  举报