freeCodeCamp/guide/chinese/miscellaneous/rename-local-branches-in-git/index.md

22 lines
534 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Rename Local Branches in Git
localeTitle: 在Git中重命名本地分支
---
要重命名本地分支,请在终端中输入以下内容:
> `-m`代表move就像`mv`在linux中用来重命名文件一样。
```
git branch -m <oldname> <newname>
```
如果您已经签出了要更改的分支:
```
git branch -m <newname>
```
下面是一个重命名`feature/react-challenges`分支来`fix/react-hikes`来自FreeCodeCamp的示例
```
git checkout feature/react-challenges
git branch -m fix/react-hikes
```