I'm trying to learn git with a dummy project and I'm facing a problem. I was trying to delete a file from my repo so it doesn't show up on my github repo page. So I deleted the file on the master branch and committed the change. I then discovered a problem and wanted to go back. I checked out my commit in a new branch by git checkout -b <branch-name> <commit hash>
. So far so good, I even got the file that I deleted back in my folders. Now I just need to merge this with my master branch so that has the deleted file too. However when I do git checkout master
and then git merge <branch-name>
. It just says that the branch is already up to date even though I clearly don't see the deleted file when I'm in the master branch.
I tried committing changes while on this newly created branch, as stated in a comment below, however this simply says that the branch is already up to date and the working tree is clear.
I'm a bit confused about these committing and probably did something wrong. What is the issue and how do I solve it and avoid it in the future?