我想做一个提交
git commit --author="John Doe <john@doe.com>" -m "<the usual commit message>"
Run Code Online (Sandbox Code Playgroud)
其中John Doe是我想要提交其名称的某个用户.
看起来好像在git log.但是,当我这样做时gitk,作者姓名是正确的,但是从我的全局git配置设置中选择了提交者名称(因此设置为我的姓名/电子邮件).
两者之间有什么区别(提交者与作者)?
我是否应该将提交者设置为其他用户?
如果有,怎么样?
从git我可以得到时间戳:
"2011-10-04 12:58:36 -0600"
Run Code Online (Sandbox Code Playgroud)
但有没有办法表明它:
"2011-10-04 06:58:36"
Run Code Online (Sandbox Code Playgroud)
所以我想要的是摆脱-0600时区偏移.我怎样才能做到这一点?谢谢.
如何获取2014-01-01和2014-06-30之间对主分支所做的所有git提交的列表?
我知道git log会给我大致这种格式(对所有提交重复):
commit <hash>
author: <author name>
date: <date>
<comment>
Run Code Online (Sandbox Code Playgroud)
但是如何将其限制为选定日期和每个提交格式一行?
<hash> <author> <date>
<hash> <author> <date>
Run Code Online (Sandbox Code Playgroud) 我真的很喜欢简短的git日志格式,我可以看到作者,日期和更改说明,如下所示:
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
Run Code Online (Sandbox Code Playgroud)
哪个输出:
fbc3503 mads Thu Dec 4 07:43:27 2008 +0000 show mobile if phone is null...
ec36490 jesper Wed Nov 26 05:41:37 2008 +0000 Cleanup after [942]: Using timezon
ae62afd tobias Tue Nov 25 21:42:55 2008 +0000 Fixed #67 by adding time zone supp
164be7e mads Tue Nov 25 19:56:43 2008 +0000 fixed tests, and a 'unending appoi
Run Code Online (Sandbox Code Playgroud)
(来自stackoverflow问题" 链接文本 ")
现在,问题是,如何将其保存为我的机器上的新格式,因此我只需编写类似的内容,例如:
git log --format=jespers_favourite
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个git别名,从提交消息中删除字符串"[ci skip]"(放在消息的末尾),但是我遇到了转义问题.别名从作为参数传递的提交中获取所有提交HEAD.
如果我运行以下命令:
git filter-branch -f --msg-filter "sed -e \"s/\[ci skip\]$//g\"" master..HEAD
Run Code Online (Sandbox Code Playgroud)
它按预期工作.无论如何,如果我创建以下别名:
unwip = !sh -c 'git filter-branch -f --msg-filter \"sed -e \\\"s/\[ci skip\]$//g\\\"\" $0..HEAD'
Run Code Online (Sandbox Code Playgroud)
我运行git unwip master它抱怨错误的配置,但我希望它的行为与以前的commads一样.我怎样才能解决这个问题?
有没有办法让git给我输出像svn ls -v一样.基本上是每个文件的列表以及最后编辑该文件的人?像这样:
filea.txt Someone Else
fileb.txt Another Person
Run Code Online (Sandbox Code Playgroud)
也许甚至用SHA来识别发生变化的提交?
使用类似git log --abbrev-commit --pretty=format:'%h %<(72,trunc)%s %d',您可以获得带有图形的相当对齐的 git commit 消息。如果您删除该--graph选项,它将完全对齐。这是命令的大致样子
* 40f1481 Commit title message (HEAD, dev)
|\
| * 9b5122d Commit title message (debug)
| * fe7ddfe Commit title message
| * 8e4d414 Commit title message
| * 53affdd Commit title message
| * a45fbaf Commit title message
|/
* 36b23c3 Commit title message
* 5b7bfe1 Commit title message (master)
Run Code Online (Sandbox Code Playgroud)
问题在于图形符号的对齐方式混乱,正如您在前两次提交中看到的那样。这是理想情况下的样子
* 40f1481 Commit title message (HEAD, dev)
|\
| * 9b5122d Commit title message (debug) …Run Code Online (Sandbox Code Playgroud) 我在python脚本中使用此命令生成一个xml文件,该文件稍后由我们的CI系统处理:
git log -1 --date=iso --pretty=format:"<logentry revision=\"%h\" scm=\"git\">%n<author>%an</author>%n<date>%ad</date>%n<msg>%s</msg>%n"
Run Code Online (Sandbox Code Playgroud)
它以下列格式生成输出
<logentry revision="1e370f5" scm="git">
<author>Johan Govers</author>
<date>2016-02-24 13:11:15 +0100</date>
<msg>PP-204 Try out git PP-207 New build script * Add missing kind="file" to path nodes in changes xml file.</msg>
Run Code Online (Sandbox Code Playgroud)
使用git log -1显示带有换行符的消息但是使用漂亮的格式它们被省略.有没有办法产生如下的输出?
<logentry revision="1e370f5" scm="git">
<author>Johan Govers</author>
<date>2016-02-24 13:11:15 +0100</date>
<msg>PP-204 Try out git
PP-207 New build script
* Add missing kind="file" to path nodes in changes xml file.</msg>
Run Code Online (Sandbox Code Playgroud)