Getting dev branch to same level as master

Hi @all

When checkout a dev branch, commiting some changes and push them to a remote, everything is working fine.

But, when i try to revert/reset/etc. the dev branch to the master branch it only works locally.

The remote branch is in that case the resetted commits ahead.

Deleting the dev branch on the remote works till an user push his local dev branch (with the resetted commits) back to the remote.

What is the best way to rebuild a fresh “dev” branch ?


Hi @petersauber!

The answer to this depends a little on whether or not you want to keep your Git history. The simplest way to put things back to the master branch would be to merge changes from master into the development branch and then push the merge commit from your local machine to the remote development branch. This would keep all of the change history recorded.

You could also force push a revert to the development branch, but it would be important to ask the developers on the project to pull that revert onto their local machiens which can be hard to control.

There are probably other methods as well, but those are the ones that come to the top of my head currently. Hope that helps!