108

How to replace local branch with remote branch entirely in Git?

I have two branches:

local branch (the one which I work with)
remote branch (public, only well-tested commits go there)
Recently I seriously messed up my local branch. totally science gitlab

How would I replace the local branch entirely with the remote one, so I can continue my work from where the remote branch is now?

I have already searched SO and checking out to the remote branch locally does not have any effect.

TAg : totally science gitlab

 ,totally science gitlab 2023

About Nilesh Raut

I am Nilesh,3+ years Exp of SEO, content writing, and keyword research. Also rocks it as a software dev with skills in OS, web dev, Flask, Python, C++, data structures, and algorithms. 3 on Leetcode, 5*on Hackerrank more platform.

Nilesh Raut Changed status to publish July 22, 2023