|
#!/bin/bash
|
|
|
|
# Caso 1: Ramos nomeados do Mercurial
|
|
#
|
|
# (1)----(2) > stable
|
|
# / \
|
|
# (0)---(3)---(4)---(7) > default/master
|
|
# \ \ /
|
|
# \ (5)---(6) > bug
|
|
# \ \
|
|
# (8)---------(9) > feature
|
|
|
|
|
|
#
|
|
# Ramificação pelo Git
|
|
#
|
|
|
|
cd /tmp
|
|
if [ -d git-branches ]; then
|
|
rm -rf git-branches
|
|
fi
|
|
|
|
git init git-branches
|
|
cd git-branches
|
|
|
|
echo 'zero' > master.txt
|
|
git add .
|
|
git commit -m zero
|
|
git branch feature
|
|
|
|
git branch stable
|
|
git checkout stable
|
|
echo 'um' > stable.txt
|
|
git add .
|
|
git commit -m um
|
|
|
|
echo 'dois' >> stable.txt
|
|
git add .
|
|
git commit -m dois
|
|
|
|
git checkout master
|
|
echo 'três' >> master.txt
|
|
git commit -am tres
|
|
git branch bug
|
|
|
|
git merge stable -m "quatro - Merge branch 'stable'"
|
|
|
|
git checkout bug
|
|
echo 'cinco' > bug.txt
|
|
git add .
|
|
git commit -m cinco
|
|
|
|
echo 'seis' >> bug.txt
|
|
git commit -am seis
|
|
|
|
git checkout master
|
|
git merge bug -m "sete - Merge branch 'bug'"
|
|
|
|
|
|
git checkout feature
|
|
echo 'oito' > feature.txt
|
|
git add .
|
|
git commit -m oito
|
|
|
|
git merge bug -m "nove - Merge branch 'bug'"
|
|
|
|
echo -e '\n\n======\nmaster\n======'
|
|
git log --graph --pretty=oneline master
|
|
echo -e '\n\n=======\nfeature\n======='
|
|
git log --graph --pretty=oneline feature
|
|
echo -e '\n\n===\nbug\n==='
|
|
git log --graph --pretty=oneline bug
|
|
echo -e '\n\n======\nstable\n======'
|
|
git log --graph --pretty=oneline stable
|