更新时间:2022-02-09 05:18:01
转自:http://blog.csdn.net/wirelessqa/article/details/20152651
版权声明:本文为博主原创文章,未经博主允许不得转载。
$ git remote
bixiaopeng@bixiaopengtekiMacBook-Pro wirelessqa$ git remote
origin
$ git remote -v
bixiaopeng@bixiaopengtekiMacBook-Pro wirelessqa$ git remote -v
origin git@gitlab.***.com:xiaopeng.bxp/wirelessqa.git (fetch)
origin git@gitlab.***.com:xiaopeng.bxp/wirelessqa.git (push)
$ git remote -v <remote-name>
bixiaopeng@bixiaopengtekiMacBook-Pro wirelessqa$ git remote show origin
* remote origin
Fetch URL: git@gitlab.****.com:xiaopeng.bxp/wirelessqa.git
Push URL: git@gitlab.***.com:xiaopeng.bxp/wirelessqa.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (local out of date)
$ git remote add [remote-name] [url]
bixiaopeng@bixiaopengtekiMacBook-Pro robotium$ git remote add test git://github.com/paulboone/ticgit.git
bixiaopeng@bixiaopengtekiMacBook-Pro robotium$ git remote -v
origin https://github.com/RobotiumTech/robotium (fetch)
origin https://github.com/RobotiumTech/robotium (push)
test git://github.com/paulboone/ticgit.git (fetch)
test git://github.com/paulboone/ticgit.git (push)
$ git remote rm [remote-name]
bixiaopeng@bixiaopengtekiMacBook-Pro robotium$ git remote rm test
bixiaopeng@bixiaopengtekiMacBook-Pro robotium$ git remote -v
origin https://github.com/RobotiumTech/robotium (fetch)
origin https://github.com/RobotiumTech/robotium (push)
$ git remote set-url --push [remote-name] [newUrl]
$ git remote rename <old-remote-name> <new-remote-name>
$git fetch [remote-name]
说明:
$ git pull [remote-name] [本地分支名]
说明: 一般我们获取代码更新都是用Git pull, 目的是从原始克隆的远端仓库中抓取数据后,合并到工作目录中的当前分支
$ git push [remote-name] [本地分支名]
说明: 只有在所克隆的服务器上有写权限,或者同一时刻没有其他人在推数据,这条命令才会如期完成任务。 如果在你推数据前,已经有其他人推送了若干更新,那你的推送操作就会被驳回。你必须先把他们的更新抓取到本地git pull,合并到自己的项目中,然后才可以再次推送。
$git push origin test:master // 提交本地test分支作为远程的master分支
$git push origin test:test // 提交本地test分支作为远程的test分支
作者: 毕小朋 | 老 毕 邮箱: wirelessqa.me@gmail.com
微博: @WirelessQA 博客: http://blog.csdn.net/wirelessqa