git的删除操作

git的删除操作

1查看远程分支

git branch -a

2查看本地分支

git branch

3创建分支

$ git branch mybranch

4切换分支到test

$ git checkout mybranch

5要删除服务器远端的分支,则执行如下所示的命令:

git push origin –delete 分支名

git push origin :branch-name(注意空格)

注意事项:

1)命令中间的空格

2)“remote ref does not exist”

1
2
3
4
git fetch -p MY_REMOTE
// Examplegit fetch -p origin

6如果是要删除本地已经合并了的分支,则执行:

git branch –d 分支名

7下图中的命令是为了删除本地未合并的分支:

 git branch –D 分支名

 

8遇到如下错误pdates were rejected because the tip of your current branch is behind,则执行

$ git push origin route-hous -f 强制更新分支

route-hous -> route-hous (forced update)

 9)遇到如下错误

hint: See the 'Note about fast-forwards' in 'git push --help' for details
是因为git中的内容与本地中的内容不一致

①需要先fetch,然后再merge,最后上传push。

通过强制push -f 来完成

猜你喜欢

转载自shuizhongyue.iteye.com/blog/2288036