Git 笔记
2011-12-25 19:16:10| 分类:
默认分类
| 标签:
|举报
|字号大中小 订阅
Git 实在是参与开源必学的技能, 可惜我怕抽象, 下面有文字教程
Pro Git, 比较完整专业的教程 http://progit.org/book/zh/
随便的几个常用命令 http://lugir.com/git-basic.html
目前我就同步下代码而已, 基本的 push/ clone 可用, 更多需要学
今天改了 master 分支的代码, 编辑器没注意, 没法恢复了, 想起了 branch 能管理的
于是找了视频了解 http://www.youtube.com/watch?v=RDGzF2M-zlo
大概的意思是: $ git branch new_branch_name 能建立新的分支
$ git chechout new_branch_name 之后修改的代码会自动记录更改, 不影响另一个分支
然后就是合并甚至解决冲突的操作了, 看视频就很清晰了, 不像文档
然后 $ git push origin new_branch_name 也对应变了(?)
建立分支后 clone 的代码这样切换分支 http://wangliping.net/git-clone-spec-branch
删除分支比如 source 先用 $ git branch -d source 再 git push origin :heads/source
改 branchname, 搜到的命令是 $ git branch -m oldname newname
http://stackoverflow.com/questions/1526794/git-rename-remote-branch
然后更新到仓库, 我尝试的是: $ git push origin newname ; git push origin :heads/oldname
遇到下面两个错误, 我用重命名避开了, 具体不知道怎么回事
error: src refspec v0.0.2 matches more than one.
warning: refname 'v0.0.2' is ambiguous.
http://stackoverflow.com/questions/4644380/git-warning-refname-xxx-is-ambiguous
http://stackoverflow.com/questions/5280212/git-error-on-branch-creation-warning-refname-master-is-ambiguous
标签功能没闹明白, 一看原来上面的 branchname 和标签重复到了
于是了解下, $ git tag -a tagname -m 'some comments' 来新建
然后 $ git push origin tagname 提交, 会生成 zip 文件, 用来记录版本的
具体看文档, 网上搜到不少是 Pro Git 的拷贝版
http://progit.org/book/zh/ch2-6.html
评论这张
转发至微博
转发至微博
评论