使用git的时候难免会用到remote tracking,下面简要记录一下在使用git remote时的一些技巧

(1)add
  $git remote add origin https://github.com/ask/celery.git
  注:暂以celery的git作为示例,celery是一个挺不错的Distributed Task Queue,有很多值得学习的地方,在此也顺便推广一下celery
(2) show remote 
  $git remote show origin
  通过$git remote show origin来得到remote中的所有branch列表
(3)fetch
  $git fetch --depth=1 origin master
  通过depth来指定获取最近的多少个commit,可以通过这一参数来根据需要限定获取的commit个数
(4)create branch
  $git branch master
(5)merge
  $git checkout master
  $git merge FETCH_HEAD
(6)diff HEAD FETCH_HEAD
  $git diff HEAD FETCH_HEAD,检测当前HEAD和FETCH_HEAD之间的区别,如果有区别的话,可以认为是有更新或者变动,如果想通过git来做autoupdate的话,可以根据diff的结果,决定是否重新fetch
(7)create empty empty
  $git symbolic-ref HEAD refs/heads/newbranch
  $rm .git/index
  $git clean -fdx
  $<do work>
  git add your files
  $git commit -m 'Initial commit'

转载自:http://www.cnblogs.com/Jerryshome/archive/2011/11/11/2245979.html

git-git remote的更多相关文章

  1. 每日一条 Git 命令:git merge remote master

    每日一条 Git 命令:git merge remote master 当远程的分支更新后,需要将自己的代码与远程的分支合并就用以下这个命令合并. git merge remote master 如果 ...

  2. git fatal: remote origin already exists. 报错解决

    在研究git的时候,随便输了个 git remote add origin xxx; 然后再真正add 远程仓库的时候,报了git fatal: remote origin already exist ...

  3. 解决git从remote clone后所有文件都改变的问题

    遇到2次这种情况了,git从remote clone项目代码后发现所有文件都要改变,因为权限改变了,可以通过git来设置忽略权限变化 git config --global core.fileMode ...

  4. git pull的时候提示git pull <remote> <branch>

    yuanqiao@yuanqiao-PC MINGW64 /h/WorkSpace/git/dadeTest (dev)$ git pullremote: Enumerating objects: 7 ...

  5. git 获取 remote 的 url

    git 获取 remote 的 url git ls-remote --get-url [remote] 例如: git ls-remote --get-url origin  

  6. 修改Git远程地址 git config remote.origin.url "https://..."

    仓库管理: 添加或指定远程仓库地址 git remote set-url origin "https://..." git config remote.origin.url &qu ...

  7. [Git] Git基础

    远程仓库 查看远程仓库: git remote -v 添加远程仓库: git remote add <repoName> <url> 拉取远程仓库数据: git fetch & ...

  8. [git]git 分支

    什么动作,关键看你想完成什么 1. 添加新的远程分支: git push origin current_local_branch:new_remote_branch 2. 删除远程分支(冒号前必须要有 ...

  9. [git]Git与Repo入门

    转自:http://www.cnblogs.com/angeldevil/archive/2013/11/26/3238470.html 注:非常推荐的一篇关于git的博文 目录: 版本控制 一.原始 ...

  10. GIt -- git push 远程分支老是需要重新输入公钥密码问题处理?

     步骤: 先查看远程有哪些分支 删除远程分支,重新关联远程分支 最后再git push 到远程分支 git remote -v git remote rm RedisNote git remote a ...

随机推荐

  1. linux 添加开机自启动脚本

    原文 Linux设置服务开机自动启动的方式有好多种,这里介绍一下通过chkconfig命令添加脚本为开机自动启动的方法. 1. 编写脚本autostart.sh(这里以开机启动redis服务为例),脚 ...

  2. csharp:DropDownComboxTreeView

    using System; using System.Collections.Generic; using System.Text; using System.Drawing; using Syste ...

  3. mui.ajax()和asp.net sql服务器数据交互【2】json数组和封装

    今天没有做循环创建显示:可以参考张鑫旭的文章:<基于HTML模板和JSON数据的JavaScript交互> 1.ashx页面代码 //下面的封装一般框架底层都是写好的:连接 数据库和获取D ...

  4. 二十一、如何导入svg图片

    svg就相当于字体,如何将生成的svg导入到自己的项目中去呢? 1.将类似下面的文件放入自己的项目中: 2.生成的svg中有一个style.css文件,将里面的内容拷贝到你的css中,然后更改上图的路 ...

  5. 初学scrum及首次团队开发

    一.初学scrum 1.什么是scrum Scrum在英语的意思是橄榄球里的争球.而在这里Scrum是一种迭代式增量软件开发过程,经常性的被用于敏捷软件开发.Scrum包括了一系列实践和预定义角色的过 ...

  6. CSS animation online生成工具

    利用HTML5.css的一些动画功能,可以设计出非常炫酷的动画,但是由于并不是所有的浏览器都支持,所以可能需要prefix,这个过程是比较烦的.一个比较好用的线上工具: http://matthewl ...

  7. 使用Powershell 管理 Windows 2012 hyper-v复制

    HyperV复制相关命令 Suspend-VMReplication Suspends replication of a virtual machine. 暂停复制虚拟机. Resume-VMRepl ...

  8. 稳定sqlplan方法

    参考文档:SQLT (SQLTXPLAIN) - Tool that helps to diagnose SQL statements performing poorly [ID 215187.1]

  9. Oracle 死锁处理

    一.数据库死锁的现象程序在执行的过程中,点击确定或保存按钮,程序没有响应,也没有出现报错.二.死锁的原理当对于数据库某个表的某一列做更新或删除等操作,执行完毕后该条语句不提交,另一条对于这一列数据做更 ...

  10. 如果使用没有提供选项值的 SqlDependency,必须先调用 SqlDependency.Start(),然后才能执行添加到 SqlDependency 实例中的命令

    如标题错误,解决办法及出现错误情况,见图片 出现如图错误