My master branch is so different than my development branch that I would like it to just become my master branch without having to do a merge, is this possible? Seems like I could walk into a lot of work if I just try and do a merge.
Asked
Active
Viewed 1,197 times
1 Answers
10
If you just have one copy of the repo, you could just delete your master branch, create a new branch from your dev branch called master, but you will have to notify others that you have changed the branch if there are other copies of the repo you don't control.
git checkout -b dev
git branch -D master
git checkout -b master

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278

Jed Schneider
- 14,085
- 4
- 35
- 46
-
Wow, somehow I didn't dare doing that, I thought it was too simple and I couldn't see the catch. A bug in minecraft trashed my master branch (I backup my world with git), now I can get rid of the mess. Thanks! – Niriel Aug 18 '11 at 21:36
-
branches are just branches :) – Jed Schneider Aug 23 '11 at 18:20
-
what happens to the history of the original master when is deleted? – dalcantara Apr 02 '12 at 02:06
-
a branch is just a sequence of pointers to specific commits, so in effect, nothing happens to the history, you are just redefining where the head of that branch is. actually removing commits from your history is much harder. – Jed Schneider Apr 03 '12 at 17:40
-
also, now that I know git 2 years better than when i gave this answer, you could just force update the branch with `git branch -f ..` – Jed Schneider Apr 03 '12 at 17:41