Git commit bash script

后端 未结 6 2110
刺人心
刺人心 2020-12-25 10:53

I\'m writing a bash script to add, commit, push all files in a directory.

#!/bin/bash  
git add .  
read -p \"Commit description: \" desc  
git commit -m $de         


        
6条回答
  •  执笔经年
    2020-12-25 11:26

    Here's a merge of the last two answers - chaining together the add -u is awesome, but the embedded read command was causing me troubles. I went with (last line used for my heroku push, change to 'git push origin head' if that's your method):

    #!/bin/bash
    read -p "Commit description: " desc
    git add . && \
    git add -u && \
    git commit -m "$desc" && \
    git push heroku master
    

提交回复
热议问题