简体   繁体   中英

Git Reverse a commit error

In SourceTree I try to reverse a commit but I get this error:

error: The following untracked working tree files would be overwritten by merge:
    sites/default/files/php/twig/.htaccess
    sites/default/files/php/twig/5a28f4da_block.html.twig_7fdf7759ac5e05b56cecaa39f0b0b24227af874948f93eb3bebb14c9aa894bed/.htaccess
    sites/default/files/php/twig/5a28f4da_html.html.twig_a24499b556ded443d175ee53d9f684a5e80725b925c497f5ab92d5181467f3e4/.htaccess
    sites/default/files/php/twig/5a28f4da_page-title.html.twig_91e36ad5fced0c7956bcff8cb739ec0bf4854d46bf202218c344fc3a0d43ff78/.htaccess
    sites/default/files/php/twig/5a28f4da_page-title.html.twig_ae9f32c69b10e2a28019a348c025f0bc6a933c63472f540c10609bc8808faf17/.htaccess
    sites/default/files/php/twig/5a28f4da_page.html.twig_e98316829f88ea4fc6b16b37056f0f3adefa7a60d82af8e5a1df73762808a306/.htaccess
    sites/default/files/php/twig/5a28f4da_region--header.html.twig_c1997eeb08b7d8ff4138be121a639c92134e6e24eed2a368375f02e5602cf34e/.htaccess
    sites/default/files/php/twig/5a28f4da_region.html.twig_2faa3d1db693fe574b3a07bc0abb48f55576718a4c6f82784d91424dc55f0833/.htaccess
    sites/default/files/php/twig/5a28f4da_region.html.twig_311ddf326c3de6a6e9b8316f6f2b88f501e51bf84e82b8fa0d148f094acefd22/.htaccess
    sites/default/files/php/twig/5a28f4da_status-messages.html.twig_450b13c3ebfd7aa08c49fc265d16913f68d48fd1c0e7cb78497196525a8054ed/.htaccess
    sites/default/files/php/twig/5a28f4da_status-messages.html.twig_69862b5840cc89b710bf715ac3450e6a22f228bd791564412fd34ff74af41304/.htaccess
Please move or remove them before you can merge.
Aborting
Completed with errors, see above

What do I have to do to reverse this commit?

You could use git clean -f to get rid of these files.

It seems you have local changes in the working directory. You could git stash your local changes in the current branch and then follow.

But from the message you provided, it seems these are some log files that get updated on their own. You should ideally put them in the .gitignore file.

To quickly remedy the issue, you could also use git rm --cached sites/default/files/php/twig/ followed by a checkout of the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM