Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git alias with multiple command

After a review, i need to change some code and repush all my change code on the remote branch.

So i would like to automate on git with an alias (ex: git repushall) these different commands:

git add . git commit --amend (and ctrl + x) git push --force-with-lease

I know it's in the .gitconfig file

Do you have any idea ?

like image 270
Tim Avatar asked May 20 '26 04:05

Tim


1 Answers

Add the --no-edit flag to the commit command to skip the editor opening.

To link commands, you could simply separate them with ;, but as Philippe mentionned in comment, it's often more effective to chain them with &&, then each command will only run if the previous one returned a 0 (no error) code.

git config --global alias.repushall '!git add . && git commit --amend --no-edit && git push --force-with-lease'
like image 61
Romain Valeri Avatar answered May 22 '26 19:05

Romain Valeri