git branch 相关命令

  1. 创建新的branch: git branch iss53

  2. 切换到一个branch: git checkout iss53

  3. 查看所有本地branch: git branch

  4. 比较两个branch(Head): git diff branch1 branch2

  5. 重命名branch: git branch (-m | -M) [<oldbranch>] <newbranch>

  6. 复制branch并重命名 git branch (-c | -C) [<oldbranch>] <newbranch>

  7. 删除branch: git branch (-d | -D) [-r] <branchname>

  8. 舍弃修改:git checkout -f
    This will discard any local changes which are not committed in ALL branches and master.

With a -m or -M option, will be renamed to . If had a corresponding reflog, it is renamed to match , and a reflog entry is created to remember the branch renaming. If exists, -M must be used to force the rename to happen.

The -c and -C options have the exact same semantics as -m and -M, except instead of the branch being renamed, it will be copied to a new name, along with its config and reflog.

With a -d or -D option, will be deleted. You may specify more than one branch for deletion. If the branch currently has a reflog then the reflog will also be deleted.

Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist in the remote repository or if git fetch was configured not to fetch them again. See also the prune subcommand of git-remote(1) for a way to clean up all obsolete remote-tracking branches.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值