• strict warning: Non-static method view::load() should not be called statically in /drupal/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /drupal/sites/all/modules/views/handlers/views_handler_argument.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /drupal/sites/all/modules/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /drupal/sites/all/modules/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /drupal/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 0.

Revert lost data with 'git reflog'

Welcome,

Probably most of persons working with Git version control had a situation when they accidentally removed commit or reset files which should be added into changeset or somehow broken rebase process. Now the question is - how to revert move?

You can always revert your previous files state using reflog (if you added them to the commit). Reflog stores all operations executed on all of git branches existing in your repository.

Example reflog could look like the following:

$ git reflog
206e6dd HEAD@{0}: rebase finished: returning to refs/heads/dd
206e6dd HEAD@{1}: rebase: Implement XX feature
365a67d HEAD@{2}: checkout: moving from dd to 365a67d4fae27d0537f879dde623443d8adb3419^0
5ed7661 HEAD@{3}: rebase finished: returning to refs/heads/dd
5ed7661 HEAD@{4}: rebase: Implement XX feature
eb492e7 HEAD@{5}: checkout: moving from dd to eb492e74a8611c68aa9ba5ea589c657deae7c292^0
d58e96a HEAD@{6}: commit (amend): Append version
d1157da HEAD@{7}: commit: Append version
b8f919d HEAD@{8}: commit (amend): Remove limitation on Blowfish passwd
afa0099 HEAD@{9}: rebase finished: returning to refs/heads/dd

As you can see, all changes are in the following format:

[hash] HEAD@{[N]}: [description]

Where:
[hash] - is the change SHA1,
[N] - operation number (latest are the lowest numbers),
[description] - change description.

Now when you would like to come back to some state and you have no possibility to checkout specific commit, you can do that by executing:

$ git branch [name] [hash]
$ git checkout [name]

Where:
[name] - name of branch to be created.

This will create branch from specific change and checkout it. When you open gitk you will see that your HEAD is now on [hash].

Git reflog reference can be found here:

http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html