EGit:发出快进请求〜如何在EGit中为远程存储库配置提取 [英] EGit: Issuing a fast-forward pull ~ How to configure fetch for a remote repository in EGit

查看:66
本文介绍了EGit:发出快进请求〜如何在EGit中为远程存储库配置提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以让我来设置场景。我在Spring Tool Suite(Eclipse 4.5.1)中使用EGit 4.1.1。我和精通技术的同事已经从远程URL克隆了相同的git存储库。我的精通技术的同事更喜欢命令行,他使用VIM进行文件修改,然后发出命令

So let me set up my scenario. I am using EGit 4.1.1 in Spring Tool Suite (Eclipse 4.5.1). My tech-savvy coworker and I have cloned the same git repository from a remote URL. My tech-savvy coworker, who prefers the command line, does his file modification using VIM, then issues the commands

git add .
git commit -m "Modified file"
git push

现在更改在远程存储库中。现在,我不太倾向于CLI,而更喜欢GUI,现在我在Eclipse中使用EGit。要接收更改,我右键单击该项目(我最初使用EGit克隆了该项目),转到团队->拉,然后得知其中存在 没有东西可提取。出于理智的考虑,我打开了 Git Reflog视图,发现没有列出我的同事的更改,因此我开始挠头。

Now the change is in the remote repository. Now I, who am less CLI-prone and more prefer the GUI, am using EGit in Eclipse. To receive the change, I right click the project (which I originally cloned using EGit), go to Team -> Pull, and I am told that there is "Nothing to fetch". For sanity purposes, I have the "Git Reflog" view open, and I see that my coworker's change is not listed, and I begin to scratch my head.

所以我转到命令行,然后发出命令 git pull ,瞧!它拉进了我的同事的更改:

So I go to the command line and I issue the command git pull, and voila!, it pulls in my coworkers change:

remote: Counting objects: 27, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 14 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
From git://hostname.domain.com/git-repo
 * branch            master     -> FETCH_HEAD
Updating 123ae12..68cd2f0
Fast-forward

更好的是,我回到Eclipse,然后在 Git Reflog视图中看到更改,列为

Better yet, I go back to Eclipse, and I see the change in the "Git Reflog" view, listed as

Commit   Commit Message     Date         Reflog Message
---------------------------------------------------------------
68cd2f0  Modified File      2015-12-23   pull: Fast-forward

所以,我觉得在这里告诉我的内容使我相信,我不熟悉Git概念-我可能只是想念一些东西。所以...

So, I feel like what I am being told here leads me to believe that there is a Git concept that I am not familiar with - something that I'm probably just missing. So...


  • 关于git的工作,我是否明显缺少这里的信息?

  • 我假设快进意味着我只是将HEAD移到同一分支中

  • 如何在Eclipse中完成此命令行 git pull?

编辑:为了解决VonC的答案,我添加了以下信息:既是更多信息,也是该问题的解决方案。

Edit: To address VonC's answer, I have added this information that is both more information and a solution to this question.

从命令行运行时(从存储库中) cat ./.git /.gitconfig ,我得到以下输出:

From the command line, when I run (from the repository) cat ./.git/.gitconfig, I get the following output:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[remote "origin"]
        url = git://hostname.domain.com/git-repo.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

但是

推荐答案

首先,reflog不会显示任何内容在获取之前(在命令行或Eclipse中):它仅记录来自 local 克隆的更改。

First, the reflog would not show you anything before a fetch (in command line or Eclipse): it records changes from the local clone only.

第二,< a href = https://stackoverflow.com/q/25205845/6309>检查您的 .gitconfig 以了解如何配置远程源(也在此处看到)。

您需要有一行用于提取:

Second, check your .gitconfig to see how the remote origin is configured (also seen here).
You need to have a line for fetching:

fetch = +refs/heads/*:refs/remotes/origin/*

默认情况下,命令行 git fetch 将使用当前分支:

By default, the command line git fetch would use the current branch:

refs/heads/<head>:refs/heads/<branch>

这篇关于EGit:发出快进请求〜如何在EGit中为远程存储库配置提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆