Search code examples
gitrepository

I want to reset my current Git branch to master branch


I have develop & master branches, my develop branch is messy now and I would like to reset it and make it as a copy of my master. I'm not sure if merging the master into develop will make both of them identical. after trying to merge I got many conflicts I solved them using:

git merge origin/master
git checkout 

Is this enough for develop branch to be an identical copy to master


Solution

  • Literally you have the answer to your question in the own question:

    git checkout dev
    git reset --hard master
    

    git reset allows three possibilities:

    • soft: Move the branch to the point you decide, but it does not touch your index area and working directory.
    • mixed: (by default) the same as soft plus changes the Stage Area. Do not change your working directory.
    • hard: The same as mixed plus changes the working directory.

    To understand better: git reset