简体   繁体   English

在JetBrains产品中一次序列git pull-commit-push

[英]Sequence git pull-commit-push at once in JetBrains products

I would like to be able to do the git pull-commit-push action in 1 shortcut (clicking 1 option) in Android Studio / IntelliJ. 我希望能够在Android Studio / IntelliJ中的1个快捷方式(单击1个选项)中执行git pull-commit-push操作。

It would be such a convenient solution. 这将是一个方便的解决方案。 Can I do it? 我可以做吗?

IntelliJ has Commit+Push action, and also could automatically pull if the push is rejected. IntelliJ具有Commit + Push操作,如果拒绝推送,还可以自动拉动。 It is not exactly the same, but quite close. 它不完全相同,但是非常接近。

As Dmitriy said, you can force update on push rejection, see screenshot. 正如Dmitriy所说,您可以在推送拒绝时强制更新,请参见屏幕截图。

Now, the fastest keyboard shortcut I can think of, assuming you have predefined commit messages in .gitmessages and unchecked all the "Before commit" safety checks, is : ctrl+k for commit, shift+tab twice to put the cursor on commit button, press enter to commit, then ctrl+shift+k for push, the combination shift+tab once, press enter. 现在,假设您已经在.gitmessages中预定义了提交消息并且未选中所有“提交前”安全检查,我能想到的最快的键盘快捷方式是:ctrl + k进行提交,shift + tab两次将光标置于提交按钮上,按Enter提交,然后按ctrl + shift + k进行推送,同时按shift + tab组合一次,然后按Enter。 That's 7 keystrokes. 这是7击键。

So you can record this : go to Edit / Macros / Start macro recording / type the keystrokes / go back to Edit / Macros / Stop recording. 因此,您可以记录以下内容:转到“编辑” /“宏” /“开始宏记录” /键入击键/“返回”至“编辑” /“宏” /“停止记录”。

Then go to Preferences / Keymap / Macros / right click on your recorded macro and select Add Keyboard shortcut and voila your convenient shortcut. 然后转到“首选项” /“键盘映射” /“宏” /右键单击您录制的宏,然后选择“添加键盘”快捷方式,然后使用您方便的快捷方式。

If you are alone with your code and are fine with a cluttered git history and meaningless commit messages, it answers your question. 如果您独自使用代码,并且拥有混乱的git历史记录和毫无意义的提交消息,那么它将回答您的问题。

在偏好

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

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