0

I am trying to merge branch p-jira-fix changes into branch p-main changes. Branch p-jira-fix has renamed one file from UserBase to EntityBase and somehow when I am running the git commit command, I am facing the following error regarding that file :

Merge command I started with :

git checkout p-main
git pull origin p-jira-fix
cp: app/yyy/src/main/java/com/xxx/ces/domain/UserBase.java: No such file or directory
Couldn't save backup of app/yyy/src/main/java/com/xxx/ces/domain/UserBase.java

I could not find this exact error on sof or git related posts. Has anyone faced this OR resolved it?

coretechie
  • 1,050
  • 16
  • 38
  • 1
    This error message isn't a standard git error message (`git` wouldn't call the `cp` utility to copy files), it probably comes from an external script. Do you have any hooks installed on your local repository ? `ls .git/hooks`, files *not* ending with `.sample`. – LeGEC Oct 03 '22 at 06:10
  • Thanks, let me check that. I did feel the same but I wasn't sure. – coretechie Oct 03 '22 at 06:39
  • @LeGEC - Please post your comment as an answer and I will accept it. It was actually a pre-commit hook which was not able to find that file and caused this issue. Thanks. – coretechie Oct 03 '22 at 06:49

1 Answers1

0

This error message isn't a standard git error message (git wouldn't call the cp utility to copy files), it probably comes from an external script.

One standard feature which makes git execute external scripts are hooks. Check if you have any hook activated on your local repository :
run ls .git/hooks, and check for files not ending with .sample.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • 1
    It was actually a custom pre-commit hook which was not able to find that file and caused this issue. Found at .git/hooks/pre-commit – coretechie Oct 03 '22 at 07:00