在使用
github时,有创建新的远程分支的需求,但会包含之前的提交,本文介绍如何使用Git创建空的远程/本地分支,并推送到仓库
创建本地分支
git checkout --orphan=static
git checkout --orphan <fresh branch>删除新建分支所有内容
git rm -rf .创建新文件
readme.txt 或其他内容
提交
git add .
git commit -am "init branch"查看本地和远程分支情况
git branch -a垃圾回收
git gc --aggressive --prune=all推送本地分支到远程
git push origin static
git pull
git branch -a