Source Control · Web Development

How to resolve conflicts in git by enforcing the local or the remote changes?

It happens in rare cases that either the remote or the local repository is out of date compared to the other and the fast forwarding merge wouldn’t work any more.

In such a situation, one needs a way to tell git to use the up to date version without having to manually revise each file and remove the stashing.

The ours option allows us to checkout the local version, and then commit the changes.
$ git checkout –ours .

The theirs option allows us to checkout the remote version, and then commit the changes.
$ git checkout –theirs .

References:

  1. http://stackoverflow.com/a/2073854
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s