git branch tag

 

 

Branch 管理

列出本地所有分支:git branch

列出所有分支(包括本地、远程): git branch -a 

基于当前分支创建新分支:git branch ${BRANCH_NAME}

同步本地分支到远程:git push origin ${BRANCH_NAME}

删除本地分支:git branch –d ${BRANCH_NAME}

强制删除本地分支:git branch –D ${BRANCH_NAME}

删除远程分支:git push origin –d ${BRANCH_NAME}

删除本地有远程没有的分支:git fetch -p

切换分支:git checkout ${BRANCH_NAME}

 

Tag 管理

 

列出本地所有标签: git tag

基于Head节点创建标签: git tag –a ${tagName} –m ${description}

基于指定的提交ID来创建标签:git tag –a ${tagName} –m ${description} ${commit_id}

删除本地标签:git tag –d ${tagName}

同步tag到远程:git push origin ${ tagName }

同步本地 所有tag到远程:git push origin –tags

删除远程标签:git push origin –d ${BRANCH_NAME}

删除本地有远程没有的标签:git fetch -P

切换到一个本地没有,远程有的tag: git checkout -b branchName ${tagName}

切换到一个本地已有相应分支的tag: git checkout ${tagName}

 

posted @ 2022-09-14 19:42  乐享程序员  阅读(83)  评论(0编辑  收藏  举报