Git -; git blame用法

Posted feelang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git -; git blame用法相关的知识,希望对你有一定的参考价值。

执行 git blame;命令时,会逐行显示文件,并在每一行的行首显示 commit号, 提交者, 最早的提交日期 给具体文件执行 $git blame后的效果如下
6c2414fb (liangfei 2014-05-12 05:32:01 -0400  1) from markdown import markdown
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  2) from django.shortcuts import render
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  3) from django.core.paginator import Paginator, InvalidPage, EmptyPage
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  4) from blog.models import Post, Category
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  5) 
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  6) 
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  7) def category(request, cat_name, page_num=1):
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  8)     if cat_name.lower() == 'home':
be442bb4 (liangfei 2014-05-09 10:26:27 -0400  9)         posts = Post.objects.all().order_by('-date')
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 10)     else:
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 11)         posts = Post.objects.all().filter(category__name=cat_name).order_by('-date')
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 12) 
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 13)     paginator = Paginator(posts, 3)
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 14)     try:
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 15)         page = int(page_num)
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 16)     except ValueError:
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 17)         page = 1
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 18) 
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 19)     try:
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 20)         posts = paginator.page(page)
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 21)     except (InvalidPage, EmptyPage):
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 22)         posts = paginator.page(paginator.num_pages)
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 23) 
6c2414fb (liangfei 2014-05-12 05:32:01 -0400 24)     for post in posts:
6c2414fb (liangfei 2014-05-12 05:32:01 -0400 25)         post.body = markdown(post.body)
6c2414fb (liangfei 2014-05-12 05:32:01 -0400 26) 
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 27)     return render(request, 'blog/index.html',
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 28)                   
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 29)                       'posts': posts,
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 30)                       'cat_now': cat_name,
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 31)                       'cat_all': map(lambda cat: cat.name, Category.objects.all())
be442bb4 (liangfei 2014-05-09 10:26:27 -0400 32)                   )

以上是关于Git -; git blame用法的主要内容,如果未能解决你的问题,请参考以下文章

JObject 用法 JProperty 用法JArray 用法 Linq 转 Json

mark的用法和短语例句

shoe的用法和短语例句

which的用法总结

ftp的详细用法

spring的用法和短语例句