title: GIT "refs/heads/gh-pages does not point to a valid object!"
body: <p><strong>Q: How can I resolve the following errors?</strong></p>
  
  <pre><code>    error: refs/heads/gh-pages does not point to a valid object!
      error: refs/remotes/origin/gh-pages does not point to a valid object!
      error: refs/stash does not point to a valid object!
  </code></pre>
  
  <p><code>git status</code> and <code>git log</code> both work fine</p>
  
  <h3>Origin</h3>
  
  <p>I deleted the following file to free up some space as it was a colossal <code>2GB</code> as I assumed it was part of a huge <code>2GB</code> file I had committed and had attempted to remove with <code>bfg</code>. I assumed this was the last trace of it.</p>
  
  <pre><code>rm ./.git/objects/pack/pack-bec4156621c0ce105abeedad0878eedf59f10a31.pack
  </code></pre>
  
  <h3>Debugging</h3>
  
  <p>Using <code>$GIT_TRACE=1 git pull</code> I get the output below but I am wary of doing a change that might impact on my actual repository contents.</p>
  
  <pre><code>15:09:45.684046 git.c:344               trace: built-in: git 'pull'
  15:09:45.684942 run-command.c:334       trace: run_command: 'fetch' '--update-head-ok'
  15:09:45.685426 exec_cmd.c:189          trace: exec: 'git' 'fetch' '--update-head-ok'
  15:09:45.687727 git.c:344               trace: built-in: git 'fetch' '--update-head-ok'
  error: refs/heads/gh-pages does not point to a valid object!
  error: refs/remotes/origin/gh-pages does not point to a valid object!
  error: refs/stash does not point to a valid object!
  15:09:45.692615 run-command.c:334       trace: run_command: 'git-remote-https' 'origin' 'https://github.com/flipdazed/Hybrid-Monte-Carlo.git'
  error: refs/heads/gh-pages does not point to a valid object!
  error: refs/remotes/origin/gh-pages does not point to a valid object!
  error: refs/stash does not point to a valid object!
  15:09:46.658813 run-command.c:334       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
  15:09:46.667707 run-command.c:334       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all'
  15:09:46.668230 exec_cmd.c:189          trace: exec: 'git' 'rev-list' '--objects' '--stdin' '--not' '--all'
  15:09:46.670683 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all'
  error: refs/heads/gh-pages does not point to a valid object!
  error: refs/remotes/origin/gh-pages does not point to a valid object!
  error: refs/stash does not point to a valid object!
  error: refs/heads/gh-pages does not point to a valid object!
  error: refs/remotes/origin/gh-pages does not point to a valid object!
  error: refs/stash does not point to a valid object!
  15:09:46.674636 run-command.c:334       trace: run_command: 'gc' '--auto'
  15:09:46.675101 exec_cmd.c:189          trace: exec: 'git' 'gc' '--auto'
  15:09:46.677382 git.c:344               trace: built-in: git 'gc' '--auto'
  There is no tracking information for the current branch.
  Please specify which branch you want to merge with.
  See git-pull(1) for details.
  
      git pull &lt;remote&gt; &lt;branch&gt;
  
  If you wish to set tracking information for this branch you can do so with:
  
      git branch --set-upstream-to=origin/&lt;branch&gt; master
  </code></pre>