git pull is basically a shortcut for two operations:

  1. git fetch which downloads the history from the remote.
  2. git merge which merges the new history in the current branch.

It is step two where the changes from the repository get merged into your local files, because you ask git to.

The question is, why do you need to have those changes. Do you want to inspect them?

If you only want the history, without merging it, you can use plain git fetch <remote>.

 

http://stackoverflow.com/questions/18612093/applying-remote-changes-onto-local-git-pull-overwrites-files-another-way-than


Under [branch "master"], try adding the following to the repo's Git config file (.git/config):

[branch "master"]
remote = origin
merge = refs/heads/master

This tells Git 2 things:

  1. When you're on the master branch, the default remote is origin.
  2. When using git pull on the master branch, with no remote and branch specified, use the default remote (origin) and merge in the changes from the master branch.

I'm not sure why this setup would've been removed from your configuration, though. You may have to follow the suggestions that other people have posted, too, but this may work (or help at least).

If you don't want to edit the config file by hand, you can use the command-line tool instead:

$ git config branch.master.remote origin
$ git config branch.master.merge refs/heads/master

How do you get git to always pull from a specific branch?


Git doesn't work on individual files. I'm not aware of the remote_cache setting so I can't comment on that. However, in git, you have to clone the entire repository, make a change to a file(s), commit it (this is a local operation) and then push the changes back.

git: how to update (checkout) a single file from remote origin master


如何一次性添加文档:How to add all the files at once?

http://thelucid.com/2011/01/27/using-git-add-a/

git 知识罗列的更多相关文章

  1. Git知识总览(三) 分支的创建、删除、切换、合并以及冲突解决

    前两篇博客集中的聊了git的一些常用命令,具体请参见<Git知识总览(一) 从 git clone 和 git status 谈起>.<Git知识总览(二) git常用命令概览> ...

  2. 【android Studio】零git知识、零脚本命令,即刻体验git版本管理魅力!

    git的优点就不去多说了.阻碍咱新手体验它的唯一问题就是门槛太高,脚本看着像天书, 本文主要阐述的,就是如何在android studio上,也能像tfs那样,非常简单的操作,就能使用git进行版本管 ...

  3. Git知识总览(二) git常用命令概览

    上篇博客我们从 git clone 和 git status 两个命令开始,引出了一系列的git操作命令, 请参见:<Git知识总览(一) 从 git clone 和 git status 谈起 ...

  4. Git知识总览(四) git分支管理之rebase 以及 cherry-pick相关操作

    上篇博客聊了<Git知识总览(三) 分支的创建.删除.切换.合并以及冲突解决>,本篇博客我们主要来看一下 rebase 变基相关的操作.rebase 操作和 merge 操作最终都可以达到 ...

  5. Git知识总结

    Git知识总结 Git安装 windows 在git官网中下载安装程序,然后按默认选项安装即可 安装完成后,在开始菜单里找到"Git"->"Git Bash&quo ...

  6. Git知识总览(一) 从 git clone 和 git status 谈起

    本篇博客是整理git相关知识的第一篇,因为之前一直是用SourceTree对Git的命令行操作用的不是特别熟,于是乎过了一遍ProGit(链接:https://git-scm.com/book/zh/ ...

  7. git知识总结-1.git基础之git reference

    1.前言 Git版本管理的内容,是一系列由40bytes SHA-1字符串所代表patch,而Git References,则是对这些字符串的引用(也可以理解为别名).为什么需要别名呢?因为这些字符串 ...

  8. 最近学到的Git知识,大厂的Git机制还是很方便的

    本文首发于微信公众号:程序员乔戈里 转载请注明:https://blog.csdn.net/WantFlyDaCheng/article/details/102538508 一.两次的 git com ...

  9. Git知识总览(五) Git中的merge、rebase、cherry-pick以及交互式rebase

    上篇博客聊了<git分支管理之rebase 以及 cherry-pick相关操作>本篇博客我们就以Learning Git中的关卡进行展开.下方列举了LearningGit中的 merge ...

随机推荐

  1. nginx常用配置解析

    1.常用公共参数(一般放在http下面,虽然很多参数都支持server和location) keepalive_timeout  60;  #单位为s keepalive_request 2;  #设 ...

  2. eclipse启动tomcat访问localhost:8080报404

    直接双击tomcat\bin目录下面的startup.bat启动 是没问题 的 但是eclipse启动tomcat访问localhost:8080报404 解决方案如下: 双击红色圈里面的tomcat ...

  3. 二十、SAP中定义内表

    一.内表相当于传统语言的多维数组的东西,定义一个内表有以下2个方式

  4. 047-PHP数字前面补零,固定位数补0

    <?php #PHP 数字前面补零 固定位数补0 $num=128; $num=str_pad($num,8,"0",STR_PAD_LEFT); echo $num; // ...

  5. [Updating]点分治学习笔记

    Upd \(2020/2/15\),又补了一题 LuoguP2664 树上游戏 \(2020/2/14\),补了一道例题 LuoguP3085 [USACO13OPEN]阴和阳Yin and Yang ...

  6. jedis的ShardedJedisPool链接池的扩容问题

    回顾上一篇文章jedis连接池的构建. 我们来分析ShardedJedisPool的基于客户端分片所可能带来的问题:扩容 ShardedJedisPool的节点扩容 .ShardedJedisPool ...

  7. 第六篇 ORM 操作大全

    阅读目录(Content) 一 对象关系映射ORM概念 二 Django连接MySQL 三modles.py创建表 常用字段 字段合集 字段参数 DateField和DateTimeField 四.关 ...

  8. 【剑指Offer】面试题22. 链表中倒数第k个节点

    题目 输入一个链表,输出该链表中倒数第k个节点.为了符合大多数人的习惯,本题从1开始计数,即链表的尾节点是倒数第1个节点.例如,一个链表有6个节点,从头节点开始,它们的值依次是1.2.3.4.5.6. ...

  9. 读书笔记 - js高级程序设计 - 第十章 DOM

      文档元素 是文档的最外层元素,在Html页面中,文档元素始终都是<html>元素 在xml中,任何元素都可以是文档元素 Node类型 Node.ELEMENT_NODE 元素 Node ...

  10. MyBatis整体架构

    Mybatis整体架构 基础支持层 反射模块 Java中的反射很强大,但是还是需要封装的.MyBatis专门提供了反射模块,对元素的反射进行了封装,提供了简洁的API,对反射进行了优化,例如缓存了类的 ...