Files not updated with 'git pull'

I use Git to interact with other users, but today I can’t get the latest change in some files using “ git pull ”, and I don’t see the changes in “ git log ”.

What could be the problem?

+6
source share
4 answers

In my case, the problem was that I had the index.lock file in my .git folder. I removed it and pulled.

+4
source

Check the current branch.

 git status git branch 

If you are not in the branch, you are in the disabled HEAD mode and git pull will not merge anything.

 git log --all --branches 

This git log will help you ensure that there are new commits in the selected branches (i.e. tracking branches).
I use this git log alias to display these commits in a graph.

+2
source

You may have an incomplete merge that prevents traction. Check if commit is in progress.

+2
source

I just wanted to add another case where this could happen. I used a rare check. For some reason, I had a directory in the working tree that I thought was included in the rare check (I thought it was listed in .git/info/sparse-checkout ), but it wasn’t (I deleted it from .git/info/sparse-checkout for some reason, I forgot.) That way, it was just ignored by pull or checkout or reset or any other commands. This was very confusing until I began to replicate the rare order configuration in a new, new clone and realized the error.

This will only happen to you if you use a rare check. If you do not use a rare check, this cannot happen. (Check git config to see if sparseCheckout is enabled, and check for .git / info / sparse-checkout, but you would know if you are doing this since I think it should be manually configured by the user anyway. ) (Google, if you are interested in what it is - just a simple mechanism to omit files and directories from scanning, which otherwise could be tracked / pulled / extracted, etc.)

+1
source

All Articles