linux-git远程仓库与本地分支
git远程仓库操作
查看当前版本远程仓库
$git remote
origin
查看当前版本远程仓库(包含地址)
$ git remote -v
origingit@github.com:hanxt/python-cookbook.git (fetch)
origingit@github.com:hanxt/python-cookbook.git (push)
添加远程仓库
格式:git remote add [shortname] [url]
git remote add pb git://github.com/paulboone/ticgit.git
从远程仓库抓取数据
格式: git fetch [remote-name]
git fetch pb
注意:fetch操作只是将远程仓库数据拉到本地,并不进行合并操作
为远程仓库的本地副本改名和移除操作
git remote rename pb paul
git remote rm paul
git分支操作
新建版本分支
git branch testing
切换到新建的分支
git checkout testing
新建分支hotfix并切换到分支
git checkout -b hotfix
$ git branch hotfix
$ git checkout hotfix
将hotfix分支合并到master
$ git checkout master
$ git merge hotfix