'PyCharm: How to make commit+push the default?
I am very lazy and I would like to always push my commit immediately.
Is there a way to make commit+push the default? I would like to use as little keystrokes as possible.
Solution 1:[1]
As Alessandro pointed out, there is no way to make commit+push the default.
However, you can use a keybind for commit+push: Ctrl + Alt + K
Solution 2:[2]
Why not use Bash-profile to do it for you?
Thats what I do. I have automated most of my git commands with aliases and functions to automate processes such as updating my forked repo, navigating to different project folders etc.
The best option for you, given that it is not inherently supported on PyCharm, you can edit your bash-profile and simply add this function (feel free to name it as you wish):
function <name>() {
# To add all the files (if you want)
git add .
# Supply a message to be sent in the commit
git commit -a -m "$1"
git push
}
Note:
- Pass the commit message in this function
- If you don't want to add all files (by default), remove
git add . - If you want to be specific in your push command, you can supply additional arguments for upstream/branch etc as additional parameters and you can access them in your function with $2, $3 .... and so on.
- After you add this function in your bash profile, please restart your terminal or run this :
source ~/.bash_profile'(of course you've to make sure the path to the bash-profile is right)
With this, in your PyCharm, when you run this function in terminal (with arguments supplied), it will handle all the git functions mentioned inside. You can chill and see the stuff running on the screen.
I hope this achieves what you want.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | HavenSelph |
| Solution 2 |
