Automate submission of warehouses to GitHub using Bash scripts in UNIX environments

Source: Internet
Author: User

I've been writing some toy code for myself, there is a habit of submitting backups to GitHub, because this is my own code for the toy, and does not involve multiple branches, so each time it is mechanical to knock a string of the same command, in order to improve productivity, in the MAC UNIX environment to write a bash script, Every time I submit the automation to GitHub, I only need to execute this script on the line, the following gives the source code:

#!/bin/bash

echo "Start git add commit fetch merge Push"
echo "git add-a" git
add-a

echo git commit-m ' leetcode-louyuting ' "Git
commit-m ' leetcode-louyuting '

echo" Git fetch origin master
git fetch origin Master

echo "git merge Origin/master"
git merge origin/master

echo "Git push Origin master:master"
git Push Origin Master:master

This script has greatly submitted my productivity. Improved

The script above cannot set up a commit annotation with a unified annotation, so the following optimizations are followed by a dynamic setting of a commit annotation script as follows:

#!/bin/bash echo "git Add." echo "Git" Commit "echo" Enter the comment information for the commit: "comment=" commit new code "read comment git commit-m" $comment "echo" Git fetch Origin master "Git fetch origin master echo" git merge origin/master "git merge origin/master echo" Git Push origin mast Er:master "Git push origin master:master 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.