Git:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
无编辑摘要
Kangkk​(留言 | 贡献)
无编辑摘要
第9行: 第9行:




== 用户设置 ==
{{Shc_out|<syntaxhighlight lang="bash">
git config --list</syntaxhighlight>|<syntaxhighlight lang="bash">
credential.helper=osxkeychain
user.name=kangjian
user.email=kangjian@360.cn
</syntaxhighlight>|➜  ~}}
=== --global ===
设置全局用户信息。
{{shc|<syntaxhighlight lang="bash">
git config --global user.name "kangkk" && \
git config --global user.email "365@kangkk.com"</syntaxhighlight>|$|/home/kangkk}}
=== --local ===
单独设置项目内用户信息。
{{shc|<syntaxhighlight lang="bash">
git config --local user.name "kangjian" && \
git config --local user.email "kangjian@360.cn"</syntaxhighlight>|$|/home/kangkk}}
=== 设置编辑器 ===
{{shc|<syntaxhighlight lang="bash">
git config --global core.editor emacs</syntaxhighlight>|$|/home/kangkk}}
=== 设置缩写 ===
{{shc|<syntaxhighlight lang="bash">
git config --global alias.co checkout
git config --global alias.l "log --graph --oneline "
git config --global alias.ls 'log --graph --pretty=format:"%h <%an> %ar %s"'</syntaxhighlight>|$|/home/kangkk}}
示例,查看 log 信息。
{{Shc_out|<syntaxhighlight lang="bash">
git l</syntaxhighlight>|<syntaxhighlight lang="bash">
* 7376210 (HEAD -> master, origin/master, origin/HEAD) 添加通过数据库查询最后版本号码的说明
* 2afdd49 添加通过数据库查询最后版本号码
...
* b7b05de 更新 https 证书
*  f199050 Merge branch 'master' of git.a.b.net:qiwoo/xxx
|\
| * 44ad8c1 fix bug
| * 82685ae fix typo
| * 1dc08a2 fix typo
| * b5f5d7a 增加 ${HOSTNAME} 注入
| * 57e0681 更新日志位置
| * ae6b865 update think-logger 版本
* | 9ab1663 更新https的ssl证书
|/
* 6a54234 remove @2017
</syntaxhighlight>|$|/home/kangkk}}
{{Shc_out|<syntaxhighlight lang="bash">
git ls
</syntaxhighlight>|<syntaxhighlight lang="bash">
* 7376210 <kangjian> 6 周前 添加通过数据库查询最后版本号码的说明
...
* b7b05de <lizheming> 2 年 1 个月前 更新 https 证书
*  f199050 <linxd> 2 年 2 个月前 Merge branch 'master' of git.a.b.net:qiwoo/xxx
|\
| * 44ad8c1 <lizheming> 2 年 3 个月前 fix bug
| * 82685ae <lizheming> 2 年 3 个月前 fix typo
| * 1dc08a2 <lizheming> 2 年 3 个月前 fix typo
| * b5f5d7a <lizheming> 2 年 3 个月前 增加 ${HOSTNAME} 注入
| * 57e0681 <lizheming> 2 年 3 个月前 更新日志位置
| * ae6b865 <lizheming> 2 年 6 个月前 update think-logger 版本
* | 9ab1663 <linxd> 2 年 2 个月前 更新https的ssl证书
|/
* 6a54234 <linxd> 2 年 6 个月前 remove @2017
</syntaxhighlight>|$|/home/kangkk}}
== 配置文件 ==
=== .gitconfig ===
{{Hc|.gitconfig|<syntaxhighlight lang="text">
[user]
name = kangjian
email = kangjian@360.cn
[alias]
l = log --oneline --graph</syntaxhighlight>}}
=== .gitignore ===


== 初始化 ==
== 初始化 ==