Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Take a Current Git Branch and "reset" Its contents to Master

Tags:

git

At work, each developer has his own development branch we work off of, ie. branch = dev_name_of_employee. IE. dev_jon

dev_jon has a new feature with over 100 commits in it that is not ready to be tested or deployed, so I created another branch to put that new feature in called staging_jon (could have called it holding_jon, whatever).

Now I need to start on another feature and have dev_jon contain the contents of master. Kind of a revert back to master thing.

How can I do this without deleting dev_jon and its remote branch, then recreating it from master? I cant stage all these changes because they are already pushed.

Or is there just a better way to have each employee work on his/her own consistant branch during development?

like image 875
Jon Avatar asked Oct 17 '11 17:10

Jon


1 Answers

In dev_jon, you can do:

git reset --hard master

May not be directly applicable / relevant, but you can look at GitHub flow: http://scottchacon.com/2011/08/31/github-flow.html

like image 139
manojlds Avatar answered Sep 19 '22 12:09

manojlds