I have a branch with actual sources and I did not make any commits for a long time to master, and at the moment it's completely out of date. I want to just replace master's content with the content of my branch. One way to do it is to checkout both branch and master, delete master's content and copy content from branch to master, and after that push result to master.
It works, but I believe there has to be some git command to do it in a simpler way.
Does anybody know how to do it?
You can use the following command to have master point to a new location:
git branch -f master branchToMoveMasterTo
What this is actually doing is creating a new branch called master
that points to branchToMoveMasterTo
. Since we already have a branch called master, we need the -f
flag to say we want to delete the original master