常见git使用
舉例說明
先定義一下
本地分支名: local_branch遠程分支名: remote_branch克隆遠程分支到本地
git clone git@git.ipo.com:mayouchen-release/weixin-platform-frontend.git查看本地分支
git branch查看遠程和本地分支
git branch -a切換遠程和本地分支
git checkout develop //develop為分支名創建本地分支 local_branch
git branch local_branch刪除本地分支local_branch
git branch -d local_branch刪除遠程分支remote_branch
方法一:git push origin :remote_branch 方法二:git branch -d | -D branchname 刪除branchname分支 方法三:git branch -d -r branchname 刪除遠程branchname分支遠程分支 oldbranch 重新命名成 newbranch
git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已經存在,則需要使用-M強制重命名,否則,使用-m進行重命名。推送本地分支 local_branch 到遠程分支 remote_branch 并建立關聯關系 (重點)
- 遠程已有remote_branch分支并且已經關聯本地分支local_branch且本地已經切換到local_branch
- 遠程已有remote_branch分支但未關聯本地分支local_branch且本地已經切換到local_branch
- 遠程沒有有remote_branch分支并,本地已經切換到local_branch
總結
- 上一篇: react日期格式化实例
- 下一篇: HTTP和HTTPS的了解