如何一条命令切换到某个面branch 上给定时间的版本?

20 views
Skip to first unread message

Chunlin Zhang

unread,
May 11, 2011, 4:47:19 AM5/11/11
to git...@googlegroups.com
能不能做到这个?
我这里回溯的时候比较需要能做到这个.

Peter

unread,
May 11, 2011, 9:27:16 PM5/11/11
to git...@googlegroups.com
git log branchname

可以显示“branchname"的日志。

我想写一个简单的脚本可以处理这个问题
脚本解析一下“git log branchname”命令的输出,里面会有它每一个提交的日期,和提交的SHA值。

后面的处理就比较简单了吧。

On 5/11/11, Chunlin Zhang <zhangc...@gmail.com> wrote:
> 能不能做到这个?
> 我这里回溯的时候比较需要能做到这个.
>


--
liuhui998 blog http://liuhui998.com
twitter http://twitter.com/liuhui998

aleip...@gmail.com

unread,
May 11, 2011, 9:35:02 PM5/11/11
to git...@googlegroups.com
git 本身没提供这一功能吧,不过把时间和hash用脚本对应起来就方便了。

2011/5/12 Peter <liuh...@gmail.com>



--
This mail is sent using Gmail web.

Contact:
twitter: AReverie

Peter

unread,
May 11, 2011, 9:38:14 PM5/11/11
to git...@googlegroups.com
git 自身好像没有带这些功能的:)

Chunlin Zhang

unread,
May 11, 2011, 11:05:54 PM5/11/11
to git...@googlegroups.com
如果解析命令的话,应该加上 --until=<date>, --before=<date> 这样更方便.
看来只能自己搞了,有需要的话就写一个 python 脚本吧.

其实这个问题在单个 git 库的时候都还好,可以人工搞定,我现在是用 repo,面对的是 70+ 个 git 库,所以只能用程序搞了.

2011/5/12 Peter <liuh...@gmail.com>:

Peter

unread,
May 11, 2011, 11:48:56 PM5/11/11
to git...@googlegroups.com
看能不能在repo里面加

2011/5/12 Chunlin Zhang <zhangc...@gmail.com>

Chunlin Zhang

unread,
May 12, 2011, 12:02:13 AM5/12/11
to git...@googlegroups.com
repo 里加有点麻烦,要更换成自己 fork 的 repo 版本,这个好像又要搞啥签名之类的,之前没搞懂
还是写个小工具简单,这样到时候直接用 repo forall 一调用就可以了

2011/5/12 Peter <liuh...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages