How can I merge a remote branch into a local one that has one commit ahead?

35 views Asked by At

I have two machines a PC and a laptop. I was working on a project that was up to date in the laptop, in the PC and in the remote repository. Suddenly while I was in the laptop, I realized that one commit that I had done in main should be in another branch so I did a git reset --soft to the previous commit, created the new branch with git checkout -b and commited the changes to it. After that I wanted to push the changes and I had to do a git push --force. Then I came to the PC, did a git fetch, created a new local branch to make changes to the new remote branch with git branch <branch name> <base branch>, but when I want to merge origin/main into main, git gives me Already up to date.

I've tried adding -f and --force but it is not working. Of course I could do a reset --hard but I wanted to know if there is another way. I expect to have the same version of the remote repository in local.

0

There are 0 answers