I copied the local GIT repository to another place and I cannot execute

I copied the local git repository to my sites folder so that I can develop locally and then make changes to github.

When I try to execute through "git commit -a", I get this message:

E325: ATTENTION

Paging file found by name ".git / .COMMIT_EDITMSG.swp"

owned by: usrname dated: Sat Feb 4 18:56:02 2012 file name: ~myUsername/oldRepoLocation/.git/COMMIT_EDITMSG modified: YES process ID: 15435 

When opening the file ".git / COMMIT_EDITMSG"

  dated: Sun Feb 12 19:51:43 2012 NEWER than swap file! 

(1) Another program may edit the same file. If so, be careful not to be in two when creating changes using different instances of the same file. Exit or proceed with caution.

(2) Editing session failed for this file. If so, use ": recover" or "vim -r.git / COMMIT_EDITMSG" to restore the changes (see ": restoring help"). If you did, delete the swap file ".git / .COMMIT_EDITMSG.swp" to avoid this message.

The swap file ".git / .COMMIT_EDITMSG.swp" already exists!

+4
source share
2 answers

While Vim is running, it creates one .swp file per file opened in the buffer. This is for disaster recovery.

In this case, you probably copied the repo while Vim was open to edit the commit message, thereby saving the .swp file in a new copy. It is safe to delete the erroneous swp file:

rm .git/.COMMIT_EDITMSG.swp

+7
source

To add a poster to the explanation above, it's worth mentioning that you can configure vim to store all of its .swp files in a specific directory.

In the future, if you want to avoid such problems, simply create the swap_files directory in your ~/.vim/ and add this line to your .vimrc .

 set directory^=$HOME/.vim/swap_files/ 
0
source

Source: https://habr.com/ru/post/1396100/


All Articles