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/

最新文章

  1. 原生ajax实现登录(一部分代码)
  2. Apache 的 httpd.conf 详解
  3. netstat__stat
  4. 用C#制作PDF文件全攻略
  5. Beta版本冲刺计划
  6. VM安装失败
  7. wiki-editor语法
  8. c#调用js,以及js调用C#里的函数, c#自己生成js代码,实现对web的控制
  9. 将文件放到Android模拟器的SD卡中的两种解决方法
  10. X-Scan使用教程
  11. VMware Workstation 12 Pro 之安装林耐斯优麒麟 X64-UI系统
  12. day9-基础函数的学习(四)
  13. Linux-VMware Workstation&amp;CentOS-5.5-i386-bin-DVD安装
  14. 虚拟主机、VPS、ECS云服务器 区别
  15. 使用Rancher和私有仓库快速搭建Kubernetes集群
  16. SPLAY,LCT学习笔记(二)
  17. git 恢复误删的分支
  18. [日常] Go语言圣经-基于select的多路复用习题
  19. Nginx(十)-- 进程模型及工作原理
  20. 接口测试3-3Excel格式

热门文章

  1. mapper.xml实现oracle的分页语句
  2. web.xml中的classpath是啥
  3. 144-PHP trim函数的使用
  4. 075-PHP数组添加元素
  5. 用cmd运行java可以javac不行(win10)
  6. VUE3.x 前瞻
  7. Android Studio模拟器无法访问网络
  8. Java的Regex --正则表达式
  9. js基础学习之-js包装对象
  10. 关于数据库text字段