A
A
Alzasr2016-05-24 08:11:35
git
Alzasr, 2016-05-24 08:11:35

How to switch a commit in a git branch?

There are two branches: master and prod. In prod, a new version was developed, master - the old version and only hotfixes. Now I need the master branch to be identical to the prod branch. Merge cannot be done, an incredible amount of conflicts. How to switch the master branch to the same commit as prod correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Денис Загаевский, 2016-05-24
@Alzasr

git checkout master
git branch -m old-master //переименовали master на всякий случай вместо удаления
git checkout prod
git checkout -b master
git push origin --all --force

S
Sergey Nalomenko, 2016-05-24
@nalomenko

Maybe this is incorrect, but the first thing that comes to mind is to branch from the master (in order to save its state, if necessary) into a separate branch, for example, old, drop the master itself, and then branch from prod to the new master

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question