-1

My current project ran into some snags and due to this I git checkout to an older commit. I did some fiddling and progress to a point much further past my master.

I then want to essentially delete the master branch or make my development branch my master.

I can't seem to merge the branch into the master as some files have been deleted or changed causing a lot of merge conflicts, I've been unable to amend these changes, trying to delete those files locally or on my gitlab online and pulling down.

I know that deleting a master is a pretty dumb thing to do, is there a way I can make the development branch my master.

Thanks

Shikari
  • 25
  • 5
  • 4
    Does this answer your question? [How do I delete a Git branch locally and remotely?](https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-locally-and-remotely), [Rename master branch for both local and remote Git repositories](https://stackoverflow.com/questions/1526794/rename-master-branch-for-both-local-and-remote-git-repositories) – mkrieger1 Jul 26 '21 at 14:33
  • 1
    P.S. In the settings page from Gitlab, you should make master branch "unprotected` to make force pushing work – emremrah Jul 26 '21 at 14:36

2 Answers2

3

I don't think you need to actually delete any branches here. Instead, all you need to do here is to hard reset your master branch to develop:

# from master
git reset --hard develop

Then, you'll have to force push your rewritten master branch to the remote:

# again, from master
git push --force origin master
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
1

If you want to overwrite the remote master do git push origin <your_branch_name> --force

NicLovin
  • 317
  • 3
  • 20