Git useful command for reverting unwanted change

This are some git useful commands for revering change

  •  git reset --hard
    This command will discard any change that were made from the last commit (including staged file) but will not touch in untracked files
  • git clean -f
    remove all untracked files.
  • git checkout <commit-hash> <file-name>
    restore the file to what it has been when the commit-hash commit created.

 

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