简体   繁体   English

magit:快速提交更改的最快方法

[英]magit: Quickest way to quickly commit changes

I'm in the magic-status window.我在魔法状态窗口中。 I've been hacking away in a git repository for about an hour, now I have a bunch of unstaged files, and "untracked" files.我已经在 git 存储库中进行了大约一个小时的黑客攻击,现在我有一堆未暂存的文件和“未跟踪”的文件。

Whats the quickest/easiest/minimal-keystroke way to "Save these changes"什么是“保存这些更改”的最快/最简单/最少的击键方式

I'm hoping there would be something like:我希望会有类似的东西:

Press key "x"
Enter commit message followed by enter

Curious to know how you guys do it...很想知道你们是怎么做到的...

The easiest way might be to set up an alias to do what you want.最简单的方法可能是设置别名来执行您想要的操作。

The problem with that is passing in an argument, as this isn't allowed for a basic text alias.问题是传入一个参数,因为这对于基本文本别名是不允许的。

Instead, you'd have to call git through a shell:相反,您必须通过 shell 调用 git:

qc = "!sh -c \\"git add -A && git commit -m \\"$1\\"\\""

QC stands for quick commit. QC 代表快速提交。 Then you just call this as follows:然后你只需按如下方式调用它:

git qc "Added such and such feature"

This currently only takes the first word of the commit message you provide, so I'll leave it as an exercise for you to correctly format the alias as I'm seeing slashes and quotes everywhere I look right now!这目前只需要您提供的提交消息的第一个单词,所以我将把它作为练习让您正确格式化别名,因为我现在看到的到处都是斜杠和引号!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM