Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With git, how do I reset the local deployment branch to origin's version?

Tags:

git

I've got a local branch called deployment. This branch is also on origin. How do I reset the local deployment branch to the state of origin's deployment branch?

Something like the following:

git fetch origin
git reset --hard origin/deployment

Would that be possible?

like image 684
Tom Avatar asked May 19 '12 08:05

Tom


1 Answers

That's correct, but be careful - git reset --hard throws away all uncommitted changes, i.e. those just in your working tree or the index (staging area). Also, just make sure that you really are on the deployment branch with git checkout deployment, since git reset always changes the position of the current branch, i.e. the one that HEAD points to.

like image 134
Mark Longair Avatar answered Nov 10 '22 17:11

Mark Longair