alias git_ls_tree="git ls-tree --full-tree -r HEAD"
alias git_ls_files="git ls-files --full-name"
+git_commit_push_merge_file_user() {
+ declare file="${1:?Args 1: file is missing}"
+ shift
+ declare comment="${@:?Args 2: comment is missing}"
+
+ if [ ! -f "$file" -o ! -r "$file" ]; then
+ echo "Can not find or read file '$file' !" 1>&2
+ return 1
+ fi
+
+ declare owner=$(ls -dl "$file" | awk '{print $3}')
+ [ -n "$owner" ] || return
+
+ declare cmd=""
+ if [ "$owner" != "$(id --user --name)" ]; then
+ true
+ fi
+
+ declare branch="$( cd "$(dirname "$file")" && git branch | awk '/^\*/{print $2}')"
+ cat<<EOF
+cd "$(dirname "$file")" || exit
+. ~/.profile
+git_branch
+echo git_commit_push "$comment" && (\
+ [ "\$(git branch | awk '/^\\*/{print \$2}')" = "master" ]\
+ || echo git_merge_to master\
+ )
+EOF
+
+}
+
git_new_branch() {
git checkout -b "$1"
git push -u origin "$1"