blog: 添加《git修改分支名》
This commit is contained in:
parent
3d09961b23
commit
4b930d634b
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
## 同时修改本地分支名和对应的远程分支名
|
||||
|
||||
修改前要确保本地分支的代码是最新的,并且修改后不会影响到同事的代码。
|
||||
|
||||
1. 修改本地分支名
|
||||
```sh
|
||||
git branch -m oldBranchName newBranchName
|
||||
```
|
||||
|
||||
2. 删除远程分支
|
||||
```sh
|
||||
git push origin :oldBranchName
|
||||
```
|
||||
|
||||
3. 改名后的本地分支推送到远程
|
||||
|
||||
```sh
|
||||
git push --set-upstream origin newBranchName
|
||||
```
|
||||
Loading…
Reference in New Issue