[1].branch
git branch 不带参数:列出本地已经存在的分支,并且在当前分支的前面加“*”号标记,例如:
git branch
显示
Ratslam Ratslam_Writeini beta_devel command_adapter fsm_devel fsm_interface fsm_ngh fsm_robot fsm_robot_charging_wcb fsm_robot_combain fsm_robot_navigating_cl * master tts_iflytek
git branch -r 列出远程分支,例如:
git branch -r
显示
➜ iRabbit git:(master) git branch -r origin/HEAD -> origin/master origin/Tarsbot/Ratslam origin/Tarsbot/Ratslam_Writeini origin/beta_devel origin/cloud_envdata origin/cloud_msg_share origin/command_adapter origin/command_cfg origin/fsm_devel origin/fsm_interface origin/fsm_ngh origin/fsm_ngh1 origin/fsm_rabbit_robot_wcb origin/fsm_robot origin/fsm_robot_charging_wcb origin/fsm_robot_combain origin/fsm_robot_navigating_cl origin/gwb origin/master origin/rabbit_dev_wcb origin/robot_gwb origin/tts_iflytek
git branch -a 列出本地分支和远程分支,例如:
git branch -a
显示,本地为黑色远程红色
iRabbit git:(master) git branch -a Ratslam Ratslam_Writeini beta_devel command_adapter fsm_devel fsm_interface fsm_ngh fsm_robot fsm_robot_charging_wcb fsm_robot_combain fsm_robot_navigating_cl * master tts_iflytek remotes/origin/HEAD -> origin/master remotes/origin/Tarsbot/Ratslam remotes/origin/Tarsbot/Ratslam_Writeini remotes/origin/beta_devel remotes/origin/cloud_envdata remotes/origin/cloud_msg_share remotes/origin/command_adapter remotes/origin/command_cfg remotes/origin/fsm_devel remotes/origin/fsm_interface remotes/origin/fsm_ngh remotes/origin/fsm_ngh1 remotes/origin/fsm_rabbit_robot_wcb remotes/origin/fsm_robot remotes/origin/fsm_robot_charging_wcb remotes/origin/fsm_robot_combain remotes/origin/fsm_robot_navigating_cl remotes/origin/gwb remotes/origin/master remotes/origin/rabbit_dev_wcb remotes/origin/robot_gwb remotes/origin/tts_iflytek
git branch 创建一个新的本地分支,需要注意,此处只是创建分支,不进行分支切换,例如:
当前的分支依然是master,不进行切换。
git branch mybranch
显示
git branch * master mybranch
创建分支并切换到该分支
git branch -b mynewbranch
显示
git branch
master
mybranch
* mynewbranch
[2].分支重命名
git branch -m oldname newname
如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名
删除本地分支
git branch -d | -D branchname //删除branchname分支
删除远程分支
git push --delete origin feixiao5566 //超好用
待考证功能的命令
git branch -d -r branchname //删除远程branchname分支
you lust for my life, darkness and light