Abel Melquiades Callejo Abel Melquiades Callejo - 1 year ago 122
Git Question

How to make a branch as master w/o using git merge?


  • master

  • staging ~contains latest version

Current setup


Make staging as master

What I want to do now is to make
as the
without using
git merge
because I am no longer able to keep track of the changes and the position of the heads.

Current branch is staging and I wanted to achieve this

+-master-+-master--+-master--+ +-master-+

Can the master be overridden by staging using these steps?

  1. git checkout master

  2. change something

  3. git add *

  4. git commit -m "override the master version"

  5. git push -u origin master

Answer Source

If I understood your question correctly, you can do

git checkout master
git reset --hard staging

This will make master point to the same commit as staging. If your master has any commits that are not in staging you will lose them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download