git远程分支管理linux
使用分支的原则git
远程分支管理github
在远程GitHub上建立dev分支服务器
克隆远程GitHub仓库(只会克隆 apeng仓库中的master分支)ide
[root@localhost ~]# mkdir /remote [root@localhost ~]# cd /remote [root@localhost remote]# git clone https://github.com/apenglinux/apeng.git [root@localhost remote]# ls apeng [root@localhost remote]# cd apeng/ [root@localhost apeng]# git branch * master
查看远程仓库的全部分支code
[root@localhost apeng]# git ls-remote origin ec531a27522b5982a0d78efdddc836702e4d6498 HEAD ec531a27522b5982a0d78efdddc836702e4d6498 refs/heads/dev ec531a27522b5982a0d78efdddc836702e4d6498 refs/heads/master
克隆远程服务器apeng仓库中的dev分支,建立文件推送到远程服务端blog
[root@localhost apeng]# git checkout -b dev origin/dev 分支 dev 设置为跟踪来自 origin 的远程分支 dev。 切换到一个新分支 'dev' [root@localhost apeng]# echo "apeng-repository" > apeng-local-remote.file [root@localhost apeng]# git add apeng-local-remote.file [root@localhost apeng]# git commit -m "add apeng-local-remote.file" [root@localhost apeng]# git push
本地分支和远程分支一致时,默认推送全部分支。下面就推送一个分支到服务器端开发
[root@localhost apeng]# git branch aling [root@localhost apeng]# git checkout aling [root@localhost apeng]# echo "branch-aling" > aling1.txt [root@localhost apeng]# git add aling1.txt [root@localhost apeng]# git commit -m "add aling1.txt" [root@localhost apeng]# git push origin aling
在服务端查看rem
总结:it