Ad

EGit: Issuing A Fast-forward Pull ~ How To Configure Fetch For A Remote Repository In EGit

- 1 answer

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

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.

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

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

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...

  • Is there anything obvious I am missing here about the workings of git?
  • I am assuming that fast-forward means I am just moving my HEAD forward in the same branch
  • How do I accomplish this command-line "git pull" in Eclipse?

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

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

However, when I go into Eclipse and look at the fetch configuration, it is blank.

Ad

Answer

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

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/*

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

refs/heads/<head>:refs/heads/<branch>
Ad
source: stackoverflow.com
Ad