Chinaunix首页 | 论坛 | 博客
  • 博客访问: 628059
  • 博文数量: 149
  • 博客积分: 3901
  • 博客等级: 中校
  • 技术积分: 1558
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-16 14:33
文章分类

全部博文(149)

文章存档

2014年(2)

2013年(10)

2012年(32)

2011年(21)

2010年(84)

分类: 项目管理

2012-06-11 18:41:50





1. git checkout  [ tag / hashcode / branch ] 都是可以的

2. git 来回 checkout  ,会出现一个 临时分支。
  当你有 【警告:您正丢下 1 个提交,未和任何分支关联:   0d792cb 5.0.1】
   需要非常小心
   1. 记住最后一次提交的 hashcode, 要不当你 checkout 过去后 ,刚修改的 就找不回了。
   2. 或按照提示
     git branch new_branch_name 0d792cbf48e0dc5bac6f218101c7bde6ffb914e7

3. 往回 切 历史版本 最好两句一块用
    git checkout v1(历史版本)
    git checkout -b v1.1 (新生成这个历史版本的分支)

3. 代码提交后的最后 checkout 到 branch master 。
   然后 让 master 下 : git merge 合并刚才分支


 

一个很牛x的 git-log 日志格式 :
1. git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
2. 在 .git/config  中添加
 [alias]
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
3. 或者
  git config  alias.lg  "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"


* 0d792cb - (HEAD, master) 5.0.1 (3 分钟之前)
*   e97ac90 - (tmp) v5 (10 分钟之前)
|\ 
| * 767bc3c - (b2.1) b2.1 (54 分钟之前)
* | e1140c4 - (v4) v4 (57 分钟之前)
* | 7170114 - v3 (58 分钟之前)
|/ 
* d2c130f - (v2) v2 (59 分钟之前)
* 71abf18 - (v1) v1 (61 分钟之前)
* 86c31d0 - (init) init (62 分钟之前)


阅读(2092) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

liurhyme2012-06-12 18:20:30

挺好的