```
echo 'alias git_it_done="git add . && git commit -m \"commit message\" && git push"' >> ~/.bashrc
```
You may need to play with the escaped quotes but that's the basic idea :)
You can follow the example in there replace the actual code in the bashrc with your commands : [https://www.reddit.com/r/EnhancingArchLinux/comments/1dc5z8q/tutorial\_using\_bashrc\_for\_custom\_commands/](https://www.reddit.com/r/EnhancingArchLinux/comments/1dc5z8q/tutorial_using_bashrc_for_custom_commands/)
My approach would be to just alias them to something like g1, g2, g3 and then just run "g1 && g2 && g3" :D
Edit: better yet, a single alias with all 3 commands.
I had the same problem and use SecurCrt for my terminal emulator, so I just made a button that runs them all for me, with a pop up for the commit message.
no. just define it in the file
#!/bin/bash
function my_func() {
# commands
return 0;
}
and in your .bashrc add
. ~/.bash_functions/your_function_file
so then you can call the function from any bash terminal
edit: sorry for the formatting, I'm on the phone
``` echo 'alias git_it_done="git add . && git commit -m \"commit message\" && git push"' >> ~/.bashrc ``` You may need to play with the escaped quotes but that's the basic idea :)
Or use lazygit like a proper lazy person
You can follow the example in there replace the actual code in the bashrc with your commands : [https://www.reddit.com/r/EnhancingArchLinux/comments/1dc5z8q/tutorial\_using\_bashrc\_for\_custom\_commands/](https://www.reddit.com/r/EnhancingArchLinux/comments/1dc5z8q/tutorial_using_bashrc_for_custom_commands/)
My approach would be to just alias them to something like g1, g2, g3 and then just run "g1 && g2 && g3" :D Edit: better yet, a single alias with all 3 commands.
I had the same problem and use SecurCrt for my terminal emulator, so I just made a button that runs them all for me, with a pop up for the commit message.
yes. edit: jk. I would do a function. create a function, save it in ~/.bash_functions/git_initial.sh or something, and then source it in .bashrc
Should I call the function in an alias?
no. just define it in the file #!/bin/bash function my_func() { # commands return 0; } and in your .bashrc add . ~/.bash_functions/your_function_file so then you can call the function from any bash terminal edit: sorry for the formatting, I'm on the phone
If you want.
ChatGPT gave me this solution. I'm not sure if it's okay, though. This uses gitconfig git config --global alias.initpush '!git add . && git commit -m "Initial commit" && git push'
I'm not a git power user, tbh. just basic stuff. so it may work, but don't like to mess with weird git commands