[英]How to automate git commands
Is there a way I can write a script to automatically run git commands? 有没有办法我可以编写脚本来自动运行git命令? 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: run git push
,它将自动为我运行命令:
git add .
git commit -m 'wip'
git push origin
etc. 等等
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'
当然,您可以编写一个执行所需命令的Shell脚本,也可以制作一个git别名,如git config --global alias.p '!git add . && git commit -m "wip" && git push origin'
git config --global alias.p '!git add . && git commit -m "wip" && git push origin'
to be able to run git p
later on. git config --global alias.p '!git add . && git commit -m "wip" && git push origin'
以便以后可以运行git p
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.