While learning HTML and CSS, I created a repository to track the progress of the respective tutorial.
I organzied the repository in a way that people can access the different phases of the tutorial (and also my own solutions) simply by changing the branch.

At some point I accidently commited the result of a later phase of the tutorial to an earlier branch (1-42-05-solution).
But the respective branch was actually meant to stay at exactly that commit which shows the progress at that earlier point.

Git – Remote Branches points out:

It’s important to note that when you do a fetch that brings down new remote branches, you don’t automatically have local, editable copies of them. In other words, in this case, you don’t have a new serverfix branch – you only have an origin/serverfix pointer that you can’t modify.

GitHub: Modify Pointer of remote Branch – not possible😕

You can’t modify the pointer of remote branches on GitHub
… But you can delete old branches, create new ones with the same name locally (at the correct commit) and then push them to the remote repository again.

Modify Pointer by Deletion and Recreation

That’s how I solved the issue:

  1. delete branch 1-42-05-solution in GitHub repository
  2. update local repository using git remote prune origin (to get rid of deleted remote branch locally)
  3. create new 1-42-05-solution branch locally at correct commit
  4. push new local 1-42-05-solution branch to remote repository

After that change you can now find the solution on the 1-42-05-solution branch as expected.👌