0

I deleted a swap file and called git stash before making a pull request. When i tried git stash pop, i got following error

Cannot apply to a dirty working tree, please stage your changes

I followed this wiki and tried to apply via patching the changes. But it is not working.

I guess this message will give some hint

diff --git a/db/.schema.rb.swp b/db/.schema.rb.swp
deleted file mode 100644
index 6570b8e..0000000
Binary files a/db/.schema.rb.swp and /dev/null differ

How to resolve this?

Community
  • 1
  • 1
robert
  • 8,459
  • 9
  • 45
  • 70

1 Answers1

0

You SHOULD NOT commit the swap file into git repository. Try to follow the instructions:

git rm db/.schema.rb.swp   # Delete the swap file from git repository
echo "*.swp" >> .gitignore # Ignore swap files
git add .gitignore
git commit                 # Commit the deletion & changes
git status                 # Make sure that you have no uncommited changes
git stash apply            # Then apply the stash
miaout17
  • 4,715
  • 2
  • 26
  • 32