How to revert files with unwanted changes while using git?

Posted: March 14, 2013 by Sankar Vijayakumar in Git
Tags: , , , , , , ,

How to resolve git conflict

git conflict revert

First of all, I would like to say that I don’t know much about git. I started using git from last week onwards and I could resolve a git conflict in the following way:

  1. Identify the conflicted files.
  2. Go to the folder of the files conflicted.
  3. Take a backup of the files.
  4. Then use the below command to replace the files conflicted with most recent git commit:

    git checkout HEAD -- filename # the version from the most recent commit
    git checkout HEAD^ -- filename # the version before the most recent commit

  5. Update the files with the changes made earlier and commit.
  6. Problem solved. Be Happy :lol:!!

Reference link: http://stackoverflow.com/questions/692246/how-do-i-revert-one-file-to-the-last-commit-in-git

Advertisements

How's it? Your comments and suggestions...

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