While collaboration, you may need to pull, commit, and push in CLI. Followings are bash scripts I use in my system.
Fetch all the source codes in the current repository
git_fetch.sh
#!/bin/bash sudo -u apache git branch --set-upstream-to=origin/master master sudo -u apache git fetch --all sudo -u apache git pull
Pull in the current repository
git_pull.sh
#!/bin/bash sudo -u apache git branch --set-upstream-to=origin/master master sudo -u apache git pull
Fetch codes and Merge in the current repository
git_merge.sh
#!/bin/bash sudo -u apache git branch --set-upstream-to=origin/master master sudo -u apache git fetch --all sudo -u apache git merge origin master
Commit codes in the current working directory
git_commit.sh
#!/bin/bash echo Please input your commit message below \(blank to put as "bug fix"\) read commit sudo -u git branch --set-upstream-to=origin/master master 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
Clean codes in the current working directory
git_clean.sh
#!/bin/bash echo Please input your clean up message below \(blank to put as "clean up commit messages"\) read commit sudo -u apache git branch --set-upstream-to=origin/master master sudo -u apache git checkout --orphan latest_branch sudo -u apache git add -A if [ ! "$commit" ]; then sudo -u apache git commit -am "clean up commit messages" else sudo -u apache git commit -am "$commit" fi sudo -u apache git branch -D master sudo -u apache git branch -m master sudo -u apache git push -f origin master