git 分支, 合併, tag 之範例
# 建立 develop branch
git branch develop
git checkout develop
git branch
for t in {1..5};
do
TAG=v0.${t}
FEATURE=feature/${TAG}
# 建立 feature branch
git branch ${FEATURE}
git checkout ${FEATURE}
git branch
# commit 5個版本
for i in {1..5};
do
data=$(printf "${FEATURE}-%03d" $i)
echo $data >> history.txt
history=$(cat history.txt)
printf "# Test\n## Version\n${data}\n## History\n\`\`\`\n${history}\n\`\`\`\n" > readme.md
git add .
git commit -m "version: ${data}"
git push -u origin ${FEATURE}
done
git branch
# 切換develop
git checkout develop
git branch
# 合併
git merge --no-ff -m "合併(from ${FEATURE} to develop)" ${FEATURE}
git push -u origin develop
# 刪除分支
git branch -d ${FEATURE}
git push -u origin :${FEATURE}
git push -u origin develop
# 切換到master
git checkout master
git branch
# 合併
git merge --no-ff -m "合併(from 合併 to master)" develop
git push -u origin master
# 建立release
git tag ${TAG}
git tag -l
git push origin ${TAG}
done
文章短網址: https://slanla.com/__9fii6p