Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

While collaboration, you may need to pull, commit, and push in CLI. Followings are bash scripts I use in my system.


Table of Contents
stylenone

Fetch all the source codes in the current repository

Code Block
languagebash
titlegit_fetch.sh
#!/bin/bash
sudo -u apache git fetch --all


Pull in the current repository

Code Block
languagebash
titlegit_pull.sh
#!/bin/bash
sudo -u apache git pull


Fetch codes and Merge in the current repository

Code Block
languagebash
titlegit_merge.sh
#!/bin/bash
sudo -u apache git fetch --all
sudo -u apache git merge origin master


Commit codes in the current working directory

Code Block
languagebash
titlegit_commit.sh
#!/bin/bash
echo Please input your commit message below \(blank to put as "bug fix"\)
read commit
sudo -u apache git pull
sudo -u apache git add .
if [ ! "$commit" ]; then
        sudo -u apache git commit -m "bug fix"
else
        sudo -u apache git commit -m "$commit"
fi
sudo -u apache git push
sudo -u apache git pull