bash - 别名(或其他方法)在远程shell上提交之前设置git ENV变量的命令?
问题描述
我有一个远程外壳,我和其他一些人正在使用它。我想对其进行设置,以便我可以运行类似gitcole ; git commit -m"example"
.
其中 gitcole 仅为该命令设置相关的环境变量,即:
GIT_AUTHOR_NAME is the human-readable name in the “author” field.
GIT_AUTHOR_EMAIL is the email for the “author” field.
GIT_COMMITTER_NAME sets the human name for the “committer” field.
GIT_COMMITTER_EMAIL is the email address for the “committer” field.
我对bash不是很熟悉。我将如何解决这个问题?
解决方案
所以我让它像这样工作:
在我的~/.gitconfig
:
[alias]
cacm = -c user.name='colemars' -c user.email='MY_EMAIL' commit
然后你可以像这样使用它git cacm -m"commit message"
并为其他用户重复。
比我最初尝试制作的方式简单得多。
推荐阅读
- java - iText PDF:文档没有页面
- powershell - 无法在 powershell 中将自定义对象导出到 CSV
- python - 无法撤消 tkinter 文本字段中的图像
- sql - SQL逐步对列求和
- python - 通过切片扩展 numpy 数组
- python - 在 MacOS 上找不到 CSS 文件
- visual-studio-code - 如何在代码块之间的 VS Code 中留下更多空行?
- go - go-grpc 导入“google/protobuf/struct.proto”未找到或有错误
- vim - 退出 vim 后终端字体损坏
- lucene.net - Umbraco 8 检查/Lucene 查询在代码中未返回任何结果,但从后台搜索按预期工作