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?

4
  • 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. Commented Feb 16, 2012 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? Commented Feb 16, 2012 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. Commented Feb 16, 2012 at 18:34
  • I'm also impressed that you managed to misspell my name twice, in different ways. Commented Feb 16, 2012 at 18:38

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I like your solution more than my suggestion as -A also adds newly-added files.
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.
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: 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).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.