0

When I delete a file by going to the folder my self and deleting it manually (not with git command line interface), git doesn't see that a file is deleted when I perform "add ." or "commit -m".

How can I get it to see, after deleting a file, that a file is removed and it shall delete it from the deployment server during a push?

Phil
  • 13,875
  • 21
  • 81
  • 126
  • Committing a deletion (a Git question) is not exactly the same as deleting from a deployment server after a push (not really a Git question). If your deployment script is sane, doing the former will do the latter though. – Cascabel Feb 16 '12 at 15:18
  • Jeremi: my question is not about either of the things you are refering to. forget the deployment server, I am talking about the local disk. I delete something using the finder, and then I perform "git add ." but git does not see that the file is removed unless I use "git rm". I want to be able to delete files using the finder and then get the git to understand if file is deleted or not. how do I do this? – Phil Feb 16 '12 at 18:31
  • Committing a deletion means letting get know the file has been deleted, then committing that change. That's what your question is about. And the last phrase of your question is "delete it from the deployment server during a push" - if you didn't want me to think you were asking about it, then you shouldn't have put it in your question. You can edit it out now, if you want. – Cascabel Feb 16 '12 at 18:34
  • I'm also impressed that you managed to misspell my name twice, in different ways. – Cascabel Feb 16 '12 at 18:38

1 Answers1

2

Use git rm path/to/file to explicitly tell git it's removed, or git add -A . to make git pick up files having been removed from the workspace as well as added/modified.

araqnid
  • 127,052
  • 24
  • 157
  • 134
  • I like your solution more than my suggestion as `-A` also adds newly-added files. – wkl Feb 16 '12 at 14:59
  • Something so basic as "how do I remove files" is basically guaranteed to have been answered here before (and probably a hundred times). Since you have enough rep to vote to close questions, you could help the site by looking for a duplicate before answering - and answer on the other question, if you don't feel the answers are good enough. – Cascabel Feb 16 '12 at 15:22
  • Jeremy: I did look at the site. No duplicate questions. I suggest you to spend 2 more extra minutes to understand the question first before trying to talk about duplicates and your beautiful mind's logic. – Phil Feb 16 '12 at 18:32
  • @Phil: My comment was directed at araqnid, not you. I completely understand your question, and you'll find that the answers on the duplicate question entirely answer it. Your question is a duplicate of that one. Marking questions as duplicates is a way that this site helps make it easier to find good answers, both within the site and from outside (e.g. Google). – Cascabel Feb 16 '12 at 18:35