Home > Back-end >  How to overwrite remote outdated branch on git with master branch?
How to overwrite remote outdated branch on git with master branch?

Time:09-28

is it possible to overwrite remote outdated branch on git with master branch by removing all remote commits and update needed branch with latest changes from master branch?

CodePudding user response:

If you want the remote branch to look like a local branch, in history and contents, then just push the local branch into the remote branch:

git push -f the-remote local-branch:remote-branch

Again, that will set history and contents like your current branch. This means, if it's not obvious, that you are more than likely rewriting history.

CodePudding user response:

that's what I exactly searched

git checkout master
git pull
git checkout dev_branch
git reset --hard master
git push --force
  • Related