0

I'm new to git and already in love with it. so I'm doing lots of projects in PHP using PhpStorm, I got my own framework that I developing, And now thanks to git I can control versions in my system.

My problem is that I made some core changes on one project which is relatively similar some other project and I wanted to take those changes to that other project so I made a patch from my last 2 commits.

when I try to apply the patch I get these messages:

error: patch failed: .idea/workspace.xml:5
error: .idea/workspace.xml: patch does not apply

I was running this command:

git apply --check 0001-changed-only-the-urlnames-from-non-category-creation.patch 

Is there a way I could make the patch apply?? this is pretty important to me.

Thank you !

Fadey
  • 430
  • 2
  • 11
  • You should not add workspace.xml to the VCS: https://intellij-support.jetbrains.com/entries/23393067 – LazyOne Mar 28 '14 at 18:44
  • Okay, I'll try to find the way to exclude the .idea directory from my Repository. Is my patch useless now? can I make it apply somehow? – Fadey Mar 28 '14 at 19:37
  • Sorry -- no ideas from me -- I'm not using any VCS/patches – LazyOne Mar 28 '14 at 19:56
  • I tried using this command to exclude .idea: git apply --check --exclude=.idea/workspace.xml 0001-changed-only-the-urlnames-from-non-category-creation.patch got this response:fatal: unrecognized input – Fadey Mar 28 '14 at 20:39

1 Answers1

0

I would add .idea directory to .gitignore file (and exclude it from patch as well).

Normally it is not what you want to keep in repository, especially if one day another developer using IDEA will join your project.

Andrew
  • 1,756
  • 3
  • 18
  • 31
  • Hey Andrew! thanks for your answer, could you please explain to me how do I exclude .idea directory from the patch? and how do I add it to .gitignore ? Thanx! – Fadey Mar 28 '14 at 19:23
  • Sure. You must create .gitignore file in root directory of your repo and add .idea to this file (here is good list of examples https://github.com/github/gitignore ). Then you ask git to forget .idea directory by calling `git rm --cached .idea`. Any further patches will be without .idea – Andrew Mar 29 '14 at 14:27