7

Currently, I work on a team that does trunk based development.

We moved the project from SVN to GIT recently, which requires me to do a push after every commit (Ctrl+K followed by Ctrl+Shift+K).

Is there a way to configure IntelliJ to push changes to origin/master after every commit?

Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190
Wojtek
  • 1,410
  • 2
  • 16
  • 31
  • 2
    Possible duplicate of [How can I use keyboard shortcuts to do a git commit and push from IntelliJ IDEA?](http://stackoverflow.com/questions/19142104/how-can-i-use-keyboard-shortcuts-to-do-a-git-commit-and-push-from-intellij-idea) – ChiefTwoPencils Mar 19 '16 at 20:56
  • This is ill advised. This takes away the option of keeping certain branches local and makes the responsibility of pushing the codebase the tool's instead of the developer's. – Makoto Mar 20 '16 at 06:36
  • 1
    @ChiefTwoPencils the answer to the suggested question is Ctrl+K followed by Ctrl+Shift+K (or Ctrl_K followed by Alt+P as they say), which is what I do not want to do. – Wojtek Mar 23 '16 at 19:08
  • 1
    @Makoto we do not have any branches, we are forced to use git for trunk based development – Wojtek Mar 23 '16 at 19:09

2 Answers2

1

There is no option to always perform commit and push automatically. However, there is a shortcut to perform these two operations together manually. If you hover over the "Commit" button in the Commit Changes dialog, you'll see the "Commit and Push" option, which will push the changes after you commit them.

yole
  • 92,896
  • 20
  • 260
  • 197
  • 1
    thanks, it still requires Ctrl+K and Alt+P so that is even more complicated than Ctrl+K and Ctrl+Shift+K in my mind, I have tried using both for a while. Is there a plan to add it, Ctrl+Alt+K that commits and pushes for people that do trunk based development only? – Wojtek Mar 23 '16 at 19:11
  • 1
    In our environment, it does not make sense to have commit and push be separate. There really does need to be an option to tie the operations together. For us it would mean that it would be less likely to lose a commit that someone forgot to push. – wryan Mar 15 '18 at 15:54
1

if i work in Windows 10 with PhpStorm 2018.1 EAP, then i using this script for AutoHotkey Version 1.1.28. for commit and push with just one shortcut (Ctrl+K).

#IfWinActive,ahk_class SunAwtFrame
  ~^k:: ; thats Ctrl+K
    WinWaitActive,Commit Changes ahk_class SunAwtDialog,,3
    Sleep,300
    send,{CtrlDown}{Altdown}k{Ctrlup}{Altup} ; Ctrl+Alt+K that commits and pushes 
    WinWaitActive,Push Commits ahk_class SunAwtDialog,,3 
    Sleep,200
    send,{Altdown}p{Altup} ; push
    Msgbox,macro for git push in IntelliJ finished `n developed:SL5net, 23.03.2018 17:11`n (%A_LineFile%~%A_LineNumber%) 
  return

installer for autohotkey : https://autohotkey.com/download/

SL5net
  • 2,282
  • 4
  • 28
  • 44