博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git分支管理
阅读量:7021 次
发布时间:2019-06-28

本文共 1280 字,大约阅读时间需要 4 分钟。

查看远程分支

$ git branch -a* master  remotes/origin/HEAD -> origin/master  remotes/origin/master

查看本地分支

$ git branch* master

创建分支

$ git branch test$ git branch* master  test

把分支推到远程分支 

$ git push origin testTotal 0 (delta 0), reused 0 (delta 0)To https://git.xxx.xxx/xxx/xxx.git * [new branch]      test -> test

切换分支到test

$ git checkout testSwitched to branch 'test'$ git branch  master* test

删除本地分支

$ git checkout masterSwitched to branch 'master'Your branch is up-to-date with 'origin/master'.$ git branch -d testDeleted branch test (was aaadfcd).

查看本地和远程分支

git branch -a* master  remotes/origin/HEAD -> origin/master  remotes/origin/master  remotes/origin/test

在clone完成之后,Git 会自动为你将此远程仓库命名为origin(origin只相当于一个别名,运行git remote –v或者查看.git/config可以看到origin的含义),并下载其中所有的数据,建立一个指向它的master 分支的指针,我们用(远程仓库名)/(分支名) 这样的形式表示远程分支,所以origin/master指向的是一个remote branch(从那个branch我们clone数据到本地)

执行 git remote -v 的结果,看出来origin其实就是远程的git地址的一个别名。

$ git remote -vorigin  https://xxx.xxx.xxx/xxx/xxx.git (fetch)origin  https://xxx.xxx.xxx/xxx/xxx.git (push)

删除远程版本

git push origin :testTo https://xxx.xxx.net/xxx/xxx.git - [deleted]         test$ git branch -a* master  remotes/origin/HEAD -> origin/master  remotes/origin/master本文转自我爱物联网博客园博客,原文链接:http://www.cnblogs.com/yydcdut/p/4690864.html,如需转载请自行联系原作者
你可能感兴趣的文章