Jeel Jeel - 11 months ago 79
Git Question

Git merge or rebase?

I have a project in which my master branch is ahead of backup branch. Due to some issues in code we want to use the backup branch as our gold copy and overwrite the same on master. Any suggestion what should be the better approach in this case? Merge or rebase? Also please provide the command to make things more simpler.

PS: It's ok to lose the current changes in master. Infact we have branch out of master as our reference

Answer Source

You should reset the master to point to the tip of the backup. Not do a merge or rebase.

git checkout master
git reset --hard backup
git push origin

Alternatively, you can revert everything that has happened after the backup commit.