查看当前项目有哪些远程仓库

$ 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]

说明:

  1. 此命令会到远程仓库中拉取所有你本地仓库中还没有的数据。运行完成后,你就可以在本地访问该远程仓库中的所有分支
  2. fetch 命令只是将远端的数据拉到本地仓库,并不自动合并到当前工作分支,只有当你确实准备好了,才能手工合并

拉取远程仓库:

$ 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分支

GIT远程仓库的使用的更多相关文章

  1. git远程仓库

    git远程仓库: 目前我们使用到的 Git 命令都是在本地执行,如果你想通过 Git 分享你的代码或者与其他开发人员合作. 你就需要将数据放到一台其他开发人员能够连接的服务器上. 添加远程仓库: gi ...

  2. git 远程仓库 轻松创建

    很多时候,为了方面管理我们写的代码,我们采用git 远程仓库来进行管理和备份.防止代码被他人篡改或删除.那如何来进行创建远程仓库呢? 1.我们必须有一个远程服务器端,在这里可以把任意一台电脑作为服务器 ...

  3. Git远程仓库地址变更本地如何修改

    以项目test为例: 老地址:http://192.168.1.1:9797/john/test.git 新地址:http://git.xxx.xxx/john/test.git 远程仓库名称: or ...

  4. GIT 远程仓库:添加远程库、从远程库克隆

    到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题了. 可是有用过集中式版本控制系统SVN的童鞋会站出来说,这些功能在SVN里早就有了,没看出Gi ...

  5. Git -- 远程仓库简介

    到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题了. 可是有用过集中式版本控制系统SVN的童鞋会站出来说,这些功能在SVN里早就有了,没看出Gi ...

  6. Git Step by Step – (7) Git远程仓库(续)

    上一篇文章介绍了Git远程仓库的一些使用,但是还是有些东西需要补充一下,所以有了这个续篇. .gitignore 前一篇中,我们介绍了Git的patch功能,当我们生成patch之后,"gi ...

  7. Git Step by Step – (6) Git远程仓库

    前面文章中出现的所有Git操作都是基于本地仓库的,但是日常工作中需要多人合作,不可能一直都在自己的代码仓库工作.所以,这里我们就开始介绍Git远程仓库. 在Git系统中,用户可以通过push/pull ...

  8. 一次性从git远程仓库中克隆到本地。

    自动化工具 一次性从git远程仓库中克隆到本地. import os # git操作 将远程repo克隆到本地 def git_clone_cd_pull(url): # 获取仓库名称 如fullsp ...

  9. 10.Git远程仓库

    到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题了.可是有用过集中式版本控制系统SVN的童鞋会站出来说,这些功能在SVN里早就有了,没看出Git ...

  10. 搭建git远程仓库

    基于本地协议搭建git远程仓库 1.任意目录下执行git init -bare创建裸仓库,建议目录名称以.git结尾 2.共享此目录,windows下右键裸仓库目录,切换到共享面板设置完成即可获取共享 ...

随机推荐

  1. Castle Windsor 注册组件

    1.逐个注册组件即对每个接口通过代码指定其实现类,代码: container.Register( Component.For<IMyService>() //接口 .Implemented ...

  2. C# 抽象(2)

    接着上章说: 先看代码 abstract class Human { public abstract void Think(); public abstract int Age { get; set; ...

  3. 宽带、ADSL、以太网、PPPoE

    作者:北极链接:https://www.zhihu.com/question/25847423/answer/31563282来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...

  4. 基于Spring MVC的文件上传和下载功能的实现

    配置文件中配置扫描包,以便创建各个类的bean对象 <context:component-scan base-package="com.neuedu.spring_mvc"& ...

  5. 洛谷 P3381【模板】最小费用最大流

    题目描述 如题,给出一个网络图,以及其源点和汇点,每条边已知其最大流量和单位流量费用,求出其网络最大流和在最大流情况下的最小费用. 输入输出格式 输入格式: 第一行包含四个正整数N.M.S.T,分别表 ...

  6. springboot整合mybatis,druid,mybatis-generator插件完整版

    一 springboot介绍 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员 ...

  7. sublime text3文本字体大小设置

    1.perferences->settings-user 4·将以下代码粘贴进入即可 { "font_face": "source code pro, " ...

  8. flask-login

    创建扩展对象实例 from flask_login import LoginManager login_manager = LoginManager() login_manager.login_vie ...

  9. anaconda多环境配置

    分享几篇比较好的帖子: https://zhuanlan.zhihu.com/p/25198543 http://www.imooc.com/article/18123

  10. Feel Good(两遍单调栈维护区间+前缀和)

    Bill is developing a new mathematical theory for human emotions. His recent investigations are dedic ...