git分支切换问题

来源:互联网 发布:星星知我心1983 编辑:程序博客网 时间:2024/05/21 13:31

问题情况:在github上下载了master分支上的最新代码,但是master代码上有个bug,这个bug在一个分支上改好了,于是用 git checkout  切换到该分支,切换后,程序执行正常,但是由于一些误操作,使得出现这个问题:

On branch r0.11

Your branch is ahead of 'origin/r0.11' by 4129 commits.

  (use "git push" to publish your local commits)

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:   tensorflow/examples/image_retraining/retrain.py

modified:   tensorflow/examples/tutorials/mnist/mnist_with_summaries.py

modified:   tensorflow/g3doc/how_tos/summaries_and_tensorboard/index.md


no changes added to commit (use "git add" and/or "git commit -a")

意思是说,我当前虽然在该分支上,但是工作目录中的有多次commit 未push,说了是误操作,当然想返回最初的分支状态。查了很多,还是在StackOverflow上得到答案,http://stackoverflow.com/questions/16288176/your-branch-is-ahead-of-origin-master-by-3-commits

  解决方案是:git reset --hard origin/r0.11(origin/r0.11  就是你要还原的分支)

0 0
原创粉丝点击