Trung Tran
Trung Tran

Reputation: 13721

How to automate git commands

Is there a way I can write a script to automatically run git commands? For example, if I am in my terminal, is there a way I can run a command similar to:

run git push which will automatically run the commands for me:

git add .

git commit -m 'wip'

git push origin

etc.

Upvotes: 0

Views: 1290

Answers (1)

Vampire
Vampire

Reputation: 38619

Sure, you can either write you a shell script that does the commands you want or you can make a git alias like git config --global alias.p '!git add . && git commit -m "wip" && git push origin' to be able to run git p later on.

Upvotes: 8

Related Questions