简体   繁体   中英

git fetch does not work - missing commit from another branch?

I have 2 repositories: a local repository configured with Netbeans and a remote repository.

I have the same commits in both of them with one exception: the remote repository has one extra, newer commit.

I want to pull this commit to my local repository with Netbeans. So, I right click my project, Git->Remote->Pull, I choose the right branches and I press Finish. Netbeans gives an error:

Missing commit 38b55ec9cbd31cddeedec412fa9d66e2e979a3b4

I searched for this commit, but I couldn't find it in my local repository nor in my remote repository for the branch I want to pull. So, I searched for it in other branches and finally I found it in a totally different branch.

I'm not pulling that branch. Why does Git need a commit from a totally different branch?

I maintain my local repository with Netbeans, so in my local repository I don't think I have access to the command line. Is there any way I can force Git (Netbeans version) to make this pull?

Edit: In the meanwhile, I installed a git client. When I execute:

git log --full-history

It doesn't show commit 38b55ec9cbd31cddeedec412fa9d66e2e979a3b4. This is what is shows in my local repository(with a little editing) - the remote repository has one newer commit, but it's not the required commit either:

C:\\Projects\\Project1\\mavenized\\Front>git log --full-history commit 5cb2bc0ec4cc36b66422a5ed0b314343cded8e96 Author: #myname# Date: Fri Jan 31 08:29:31 2014 +0200

 Front - Live version: 30-JAN-14 

commit 6eb8a8b419cece4065eceafe733f1718cb4debec Author: #myname# Date: Wed Jan 22 14:30:37 2014 +0200

 Front - Live version: 21-JAN-14 

commit fcba1824dc8ef2bcad98d63e00b1f1a6af2495dc Author: #myname# Date: Wed Dec 18 16:58:52 2013 +0200

 Front - First Commit 

As mentioned in this answer , your git repo would need the full history for any remote (pull/fetch) command to work properly.

A git log --full-history should show that commit.

The simplest solution would be to re-clone the repo and import it in your NetBeans workspace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM