With git, how do I reset the local deployment branch to the original version?

I have a local branch named deployment . This branch is also located on origin . How to reset a local deployment branch in the state of the origin deployment branch?

Something like the following:

 git fetch origin git reset --hard origin/deployment 

Is it possible?

+4
source share
1 answer

That's right, but be careful - git reset --hard discards all uncommitted changes, i.e. those that are only in the working tree or in the index (setting area). Also, make sure that you are actually on the deployment branch with git checkout deployment , since git reset always changes the position of the current branch, i.e. the one pointed to by HEAD .

+2
source

Source: https://habr.com/ru/post/1413285/


All Articles