git
master
#!/bin/bash
cmd=$1
opt=$2
branch=$3
parent=$4
if [[ $cmd = "checkout" ]] && [[ $opt = "-b" ]]; then
if [ -z "$parent" ]; then
parent="master"
fi
/usr/bin/git checkout -b $branch $parent
else
/usr/bin/git "$@"
fi
chmod +x /path/to/git-wrapper.sh
alias git=/path/to/git-wrapper.sh
mkdir test
cd ./test
git init
echo "First line" >readme.md
git add readme.md
git commit -m "Initial commit"
git checkout -b test1
echo "Second line" >> readme.md
git commit -am "Second line"
git checkout -b test2
echo "Third line" >> readme.md
git commit -am "Third line"
git checkout master
git branch -a
git log
git merge test1
git merge test2
Initialized empty Git repository in ...
[master (root-commit) 11bd292] Initial commit
1 file changed, 1 insertion(+)
create mode 100644 readme.md
Switched to a new branch 'test1'
[test1 4ace272] Second line
1 file changed, 1 insertion(+)
Switched to a new branch 'test2'
[test2 54b7fff] Third line
1 file changed, 1 insertion(+)
Switched to branch 'master'
* master
test1
test2
Updating 11bd292..4ace272
Fast-forward
readme.md | 1 +
1 file changed, 1 insertion(+)
Auto-merging readme.md
CONFLICT (content): Merge conflict in readme.md
Automatic merge failed; fix conflicts and then commit the result.
test1
test2