码迷,mamicode.com
首页 > 其他好文 > 详细

git 的分支使用

时间:2014-11-21 23:03:41      阅读:376      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   os   使用   sp   

之前师兄在git上创建了一个新的branch,自己看到了,不过没怎么记得操作,后来师兄帮忙弄了一下,也是了解了一些大概

先交上代码,最近有点忙,随后有时间再添加注释,下面是dos窗口的一些命令。(主要是关于pull中的fetch跟merge,以及创建远程分支的track)

具体还是需要看廖雪峰的Git教程,很详细也很全

Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。

C:\Users\bigMan.huizh>的:
的: 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\bigMan.huizh>d:

D:\>cd www

D:\WWW>cd reportv2

D:\WWW\reportv2>git branch
* master

D:\WWW\reportv2>git branch -a -v
* master                210b0ae add MY_Model.php
  remotes/origin/HEAD   -> origin/master
  remotes/origin/master 210b0ae add MY_Model.php

D:\WWW\reportv2>git fetch origin graph
remote: Counting objects: 88, done.
remote: Compressing objects: 100% (60/60), done.
error: RPC failed; result=56, HTTP code = 200
ffatal: early EOF
atal: The remote end hung up unexpectedly
fatal: unpack-objects failed

D:\WWW\reportv2>git fetch origin graph
remote: Counting objects: 88, done.
remote: Compressing objects: 100% (60/60), done.
^Cpacking objects:  54% (48/88)
D:\WWW\reportv2>git branch -a -v
* master                210b0ae add MY_Model.php
  remotes/origin/HEAD   -> origin/master
  remotes/origin/master 210b0ae add MY_Model.php

D:\WWW\reportv2>git pull
remote: Counting objects: 88, done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 88 (delta 49), reused 61 (delta 22)
Unpacking objects: 100% (88/88), done.
From https://github.com/zhangbobell/reportv2
 * [new branch]      graph      -> origin/graph
Already up-to-date.

D:\WWW\reportv2>git branch
* master

D:\WWW\reportv2>git branch -a -v
* master                210b0ae add MY_Model.php
  remotes/origin/HEAD   -> origin/master
  remotes/origin/graph  9060e1f finish all the line chart with single line
  remotes/origin/master 210b0ae add MY_Model.php

D:\WWW\reportv2>git fetch origin graph
From https://github.com/zhangbobell/reportv2
 * branch            graph      -> FETCH_HEAD

D:\WWW\reportv2>git branch -a -v
* master                210b0ae add MY_Model.php
  remotes/origin/HEAD   -> origin/master
  remotes/origin/graph  9060e1f finish all the line chart with single line
  remotes/origin/master 210b0ae add MY_Model.php

D:\WWW\reportv2>git checkout --track origin/graph
error: Your local changes to the following files would be overwritten by checkou
t:
        application/core/MY_Model.php
Please, commit your changes or stash them before you can switch branches.
Aborting

D:\WWW\reportv2>git status
On branch master
Your branch is up-to-date with origin/master.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   application/controllers/management.php
        modified:   application/core/MY_Model.php
        deleted:    public/images/captcha/1416399365.4974.jpg
        modified:   public/js/management/project_edit.js

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

D:\WWW\reportv2>git status application/controllers/management.php
On branch master
Your branch is up-to-date with origin/master.

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:   application/controllers/management.php

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

D:\WWW\reportv2>git checkout -- application/controllers/management.php

D:\WWW\reportv2>git checkout -- public/js/management/project_edit.js

D:\WWW\reportv2>git checkout -- application/core/MY_Model.php

D:\WWW\reportv2>git status
On branch master
Your branch is up-to-date with origin/master.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    public/images/captcha/1416399365.4974.jpg

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

D:\WWW\reportv2>git branch
* master

D:\WWW\reportv2>git branch -a -v
* master                210b0ae add MY_Model.php
  remotes/origin/HEAD   -> origin/master
  remotes/origin/graph  9060e1f finish all the line chart with single line
  remotes/origin/master 210b0ae add MY_Model.php

D:\WWW\reportv2>git checkout --track origin/graph
Branch graph set up to track remote branch graph from origin.
Switched to a new branch graph

D:\WWW\reportv2>git branch -a -v
* graph                 9060e1f finish all the line chart with single line
  master                210b0ae add MY_Model.php
  remotes/origin/HEAD   -> origin/master
  remotes/origin/graph  9060e1f finish all the line chart with single line
  remotes/origin/master 210b0ae add MY_Model.php

D:\WWW\reportv2>^A

 

 

git 的分支使用

标签:style   blog   http   io   ar   color   os   使用   sp   

原文地址:http://www.cnblogs.com/zh9927/p/4113896.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!