git checkout master分支问题

原创 2018年04月17日 21:56:08

1、checkout报错

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git checkout master
error: Your local changes to the following files would be overwritten by checkout:
.idea/workspace.xml
Please commit your changes or stash them before you switch branches.
Aborting

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)



2、google之后,发现有一个思路,git stash git pull,试试

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git stash
Saved working directory and index state WIP on huangshan: c17864e msg function 4

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> huangshan


huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
$ git branch --set-upstream-to=origin/<c17864e> huangshan
bash: c17864e: No such file or directory

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
$

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git stash pop
On branch huangshan
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: .idea/workspace.xml

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (78333c57afb550703d0c0035593e7c929a7dd2d1)

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
$

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)


执行命令报错,看提示,需要执行git add以及git commit 

git add
Nothing specified, nothing added.
Maybe you wanted to say 'git add .'?

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git add .

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git commit -m "f4"
[huangshan 5b5596d] f4
1 file changed, 16 insertions(+), 7 deletions(-)

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git push
fatal: The current branch huangshan has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin huangshan


huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
git push --set-upstream origin huangshan

Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 557 bytes | 557.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote:
remote: To create a merge request for huangshan, visit:
remote: http://gitlab.hutaojie.com/huangshan/olmeca_split/merge_requests/new?merge_request%5Bsource_branch%5D=huangshan
remote:
To gitlab.hutaojie.com:huangshan/olmeca_split.git
c17864e..5b5596d huangshan -> huangshan
Branch huangshan set up to track remote branch huangshan from origin.

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)
$

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (huangshan)

git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)

huangshan@PC20170731eew MINGW64 /d/a/olmeca_split (master)

COM组件对象与.NET类对象的相互转换

运行环境:Visual Studio.NET Beta2, VC7, C#参考资料:MSDN级别:入门级 一、前言COM组件对象与.NET类对象是完全不同的,但为了使COM客户程序象调用COM组件一样...
  • xxcc
  • xxcc
  • 2001-10-18 11:00:00
  • 2271

git:fatal the current branch master has no upstream branch

git本地仓库push远程仓库的时候,报了
  • qqb123456
  • qqb123456
  • 2014-05-08 17:09:01
  • 24248

Git新建本地分支与远程分支关联问题:git branch --set-upstream

http://www.tuicool.com/articles/vQ36Zj git在本地新建分支, push到remote服务器上之后,再次pull下来的时候,如果不做处理会报以下提示: ...
  • hshl1214
  • hshl1214
  • 2016-04-06 13:46:50
  • 21845

git push origin master报错,解决方法

今天,用git把本地代码推送到远程服务器上时出现错误: 根据提示执行命令解决问题 : git config receive.denyCurrentBranch ignore...
  • wanghelou123
  • wanghelou123
  • 2015-01-26 11:05:52
  • 9565

Git 的origin和master分析

Git 的origin和master分析  http://lishicongli.blog.163.com/blog/static/1468259020132125247302/   首先...
  • abo8888882006
  • abo8888882006
  • 2013-10-07 10:55:19
  • 56902

github常见操作和常见错误!错误提示:fatal: remote origin already exists.

http://blog.csdn.net/dengjianqiang2011/article/details/9260435
  • god_wot
  • god_wot
  • 2013-08-29 15:26:53
  • 103077

手把手git教程(09)--多人协作,推送分支,抓取分支

多人协作 当你从远程库克隆时候,实际上Git自动把本地的master分支和远程的master分支对应起来了,并且远程库的默认名称是origin。 要查看远程库的信息 使用 git remote 要查看...
  • andylauren
  • andylauren
  • 2017-04-23 10:57:29
  • 952

深层次的讲解repo原理

软件工程由于需要不断迭代开发,因此要对源代码进行版本管理。Android源代码工程(AOSP)也不例外,它采用Git来进行版本管理。AOSP作为一个大型开放源代码工程,由许许多多子项目组成,因此不能简...
  • stoic163
  • stoic163
  • 2017-12-13 11:55:19
  • 474

android studio Git使用

查看分支 查看本地所有分支: 12 $ git branch* master master 分支前的 * 字符,它表示当前所在的分支...
  • Calo_missile
  • Calo_missile
  • 2017-05-09 16:47:34
  • 253

git branch --set-upstream develop origin/develop

idea中更新报错: Can't update: no tracked branch No tracked branch configured for branch master. To mak...
  • wodegeekworld
  • wodegeekworld
  • 2017-03-01 18:02:34
  • 509
收藏助手
不良信息举报
您举报文章:git checkout master分支问题
举报原因:
原因补充:

(最多只允许输入30个字)