Question: A co-worker and I have been working on the same branch for a week, constantly pushing/pulling changes and all of a sudden today, I hit 'pull' to see if there were any changes I needed to pull and I got an error.

This is in sourcetree by the way. The error was this:

```
git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
error: cannot lock ref 'refs/remotes/origin/angular_removal': unable to resolve reference 'refs/remotes/origin/angular_removal': reference broken
From https://bitbucket.org/colossus
 ! [new branch]        angular_removal -> origin/angular_removal  (unable to update local ref)

```

I'm in sourcetree, which has a terminal built in, but I can't seem to find a resolution here.

Answer: 
The error text was slightly different for me like:
`unable to update local ref it is [hash_code_1] but expected [hash_code_2]`.

So the command like 
`rm -rf .git/refs/remotes/origin/angular_removal` helped me only to do fetch once. Then the message would return again.

What actually helped in this situation to fix the issue permanently was:

1. go into .git subfolder of my local repository;
2. open packed-refs file;
3. find the line with branch name from error message;
4. remove it from this file;
5. now you can do fetch or pull all you like.
Just happened to me as well; one of my ref branches under my alias was corrupted. Fix:

```
rm <root of repository>.git/refs/remotes/origin/<your alias>
git fetch

```

You can use `rd /s` instead of `rm` on Windows.

Here are the detailed steps I took to fix the issue. You may choose to skip some of the steps below:

1. I first committed all my local changes in the local branch that was giving me the issue.
2. Created [git patches](https://robots.thoughtbot.com/send-a-patch-to-someone-using-git-format-patch) for my local branch.
3. Deleted my local branch.
4. Applied the following fix
5. Checked out the remote branch after running git fetch
6. Applied the necessary patch files to the local branch.

This made git restore the ref file. After that everything worked as expected again.