deepwzh的技术笔记
  • Golang
  • Python
  • Cpp
杂项
前端开发
  • 计算机网络
  • 操作系统
  • 数据库
云原生
Devops
AIGC
关于作者
  • Golang
  • Python
  • Cpp
杂项
前端开发
  • 计算机网络
  • 操作系统
  • 数据库
云原生
Devops
AIGC
关于作者
  • 杂项
  • Windows UI 自动化方案调研 (2026)v2
  • Nginx
  • 首页
  • Protobuf
  • 学习资料
  • 杂项
  • Ldap
  • 编译原理
  • 分布式

    • 分布式
    • Raft 算法
  • 开发工具

    • 开发工具
    • cloc
    • Vscode
    • 工具箱
    • Visual Studio

      • Visual Studio
      • C++ 相关
      • Visual Studio 基本知识
  • 软件设计

    • 软件设计
    • MVC
    • 领域驱动设计
    • PO、DO、DTO、VO
    • 高内聚低耦合
  • 消息队列

    • 消息队列
    • Celery
    • Kafka
    • RabbitMQ
  • 设计模式

    • 设计模式
    • 控制反转和依赖注入
    • 七大原则
  • 网络安全

    • 网络安全
    • 请求签名
    • CSRF
    • XSS
  • 版本管理工具

    • 版本管理工具
    • Git

      • Git
      • Git get 私有仓库报错
      • Github 加速
      • Clone
      • Git pull 出现 hint 时的解决方案
      • 修改提交记录的作者信息
      • Git mergr
  • 组成原理

    • 组成原理
    • CPU

Git pull 出现 hint 时的解决方案

当我们 git pull,有时会出现如下的提示

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.

简单的说,git pull 默认不带参数时,会有多种可能的选择,git 需要我们去显示指定一下

  • 本地和远程都基于某分支做了不同的修改,且无冲突

    • 若希望产生额外的合并 log
      • git config pull.rebase false
    • 若不希望产生额外的合并 log
      • git config pull.rebase true
    • 若希望拒绝自动合并
      • git config pull.ff only
  • 本地没有做修改

    • 选哪种都一样

个人建议使用 git config pull.rebase true,这样会自动合并本地和远程提交,且没有额外的多余 log 信息

Prev
Clone
Next
修改提交记录的作者信息