Files not updating using 'git pull'

Viewed 112481

I am using Git to cooperate with other users, but today I cannot get the latest change on some files using "git pull", and I cannot see the changes in "git log".

What could be the issue?

12 Answers

what worked for me is ,

  1. remove .git folder
  2. copy .git from other repo
  3. now git checkout

Before Removing , You can try

git fetch --all 
git reset --hard origin/master

You will need to replace master with the appropriate branch, which now defaults to main.

What worked for me,

git reset --hard origin/master

It showed me that some file names were too long for git to pull them from my repo and hence the mismatch and incorrect builds.

So I ran following to fix and did a hard reset again.

git config --system core.longpaths true

Thankfully it worked.

It worked for me:
Instead of
$ git pull
Use
$ git pull [remote] [local-branch> </code]

I had the same issue with our enterprise Gitlab repo which recently changed from HTTPS to SSH. As my repo still used HTTPS, any git pull got silently ignored.

After changing the origin to SSH, everything went smooth again.

git remote set-url origin git@gitlab.yourdomain.com:username/repo.git

(To get the SSH URL just click the "Clone" button in your Gitlab/Github web interface and select "Clone with SSH")

There are 2 possible sceanrios:
1. If you have any account in Bitbucket, gitlab and etc.
You might have to synchronise with your fork directory first and then perform git pull on your local branch. Basically you have to rebase your fork copy to get in sync with remote master and perform git pull in your local copy.
2. Just try to rebase your local work copy to be in sync with remote master.

git reset --hard origin/master

works for me but you have to go inside the folder and then use this command not only on the parent folder.

for me it was commits that I made locally. These commits modify something I want to pull. So git pull doesn't get the file from origin

For me the FETCH_HEAD file did not have all the branches, because my newest branch was not tracked So I:

To force delete a branch (from outside that branch)

git branch -D <branch_name>

To create a new branch from a given branch

git fetch origin <remote_branch>:<local_branch>

To make the remote branch a tracking branch

git push --set-upstream origin <branch_name>

then to test it with git fetch, I noticed my FETCH_HEAD file was now correctly updated.

Related