常见git使用
舉例說明
先定義一下
本地分支名: local_branch遠(yuǎn)程分支名: remote_branch克隆遠(yuǎn)程分支到本地
git clone git@git.ipo.com:mayouchen-release/weixin-platform-frontend.git查看本地分支
git branch查看遠(yuǎn)程和本地分支
git branch -a切換遠(yuǎn)程和本地分支
git checkout develop //develop為分支名創(chuàng)建本地分支 local_branch
git branch local_branch刪除本地分支local_branch
git branch -d local_branch刪除遠(yuǎn)程分支remote_branch
方法一:git push origin :remote_branch 方法二:git branch -d | -D branchname 刪除branchname分支 方法三:git branch -d -r branchname 刪除遠(yuǎn)程branchname分支遠(yuǎn)程分支 oldbranch 重新命名成 newbranch
git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已經(jīng)存在,則需要使用-M強(qiáng)制重命名,否則,使用-m進(jìn)行重命名。推送本地分支 local_branch 到遠(yuǎn)程分支 remote_branch 并建立關(guān)聯(lián)關(guān)系 (重點(diǎn))
- 遠(yuǎn)程已有remote_branch分支并且已經(jīng)關(guān)聯(lián)本地分支local_branch且本地已經(jīng)切換到local_branch
- 遠(yuǎn)程已有remote_branch分支但未關(guān)聯(lián)本地分支local_branch且本地已經(jīng)切換到local_branch
- 遠(yuǎn)程沒有有remote_branch分支并,本地已經(jīng)切換到local_branch
總結(jié)
- 上一篇: react日期格式化实例
- 下一篇: php-fpm介绍及配置