Igor Shvets
Igor Shvets

Reputation: 547

How to overwrite remote outdated branch on git with master branch?

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?

Upvotes: 0

Views: 153

Answers (2)

Igor Shvets
Igor Shvets

Reputation: 547

that's what I exactly searched

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

Upvotes: 0

eftshift0
eftshift0

Reputation: 30204

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.

Upvotes: 1

Related Questions