I have a project at work in which I worked on different branches for features and for different reasons the current branch that should be deployed is too different from master. I think merging it will be problematic. Should I rebase? What is the actual way to replace the master branches contents with another branch?
Asked
Active
Viewed 24 times
0
-
1Are you asking how to make a branch point to a particular revision? – Brian61354270 Aug 13 '23 at 13:52
-
If you want `master` to refer to a different commit, just change it. `git update-ref refs/heads/master other-branch` – William Pursell Aug 13 '23 at 13:54
-
1As an educational sidenote / as context for why this is simple, do note that branches "don't exist" in git. Branches are just pointers to commits. They can be moved around arbitrarily, and if you delete one, there's essentially no record that it ever existed. It's only the commits that actually carry information. If you _really_ wanted to, it's perfectly possible to use git without any branches. – Brian61354270 Aug 13 '23 at 13:58