How do I blow away my attempt to resolve git conflicts

Charles Magid picture Charles Magid · Jan 21, 2013 · Viewed 14k times · Source

I checked out 'production_branch' then did a merge of 'master_branch for_production_branch' there were massive conflicts. 'production_branch' has been deployed to production. But the conflicts require a more experienced eye. I need to get a critical patch (I will do it by hand) onto the production branch 'production_branch' so I can deploy.

git co 'production_branch'  # => 
lib/tasks/foobar.rake: needs merge
vendor/plugins/acts_as_syncable/lib/active_record/whatever.rb: needs merge
error: you need to resolve your current index first

and

git co 'master_branch for_production_branch'
lib/tasks/foobar.rake: needs merge
vendor/plugins/acts_as_syncable/lib/active_record/whatever.rb: needs merge
error: you need to resolve your current index first

How can I get back to 'production_branch' in my working directory so I can deploy a simple critical fix.

Answer

Veger picture Veger · Jan 21, 2013

You can use

git merge --abort

to abort your current merge action and revert to the situation before your started the merge. See git merge documentation for more details.

Note that it will throw away any changes your made, but I suppose this is not a problem in your current situation...