Re: Deleting files
From: Pieter de Bie <hidden>
Date: 2016-06-15 22:44:44
On 12 jun 2008, at 14:01, Shak wrote:
This is all becoming very counter-intuitive :(
It seems you are missing the concept of the index. Let's look at an example: Vienna:a pieter$ git init Initialized empty Git repository in /Users/pieter/a/.git/ Vienna:a pieter$ touch a b Vienna:a pieter$ git commit -m "Initial commit" Created initial commit f0a0fe2: Initial commit 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a create mode 100644 b Vienna:a pieter$ rm a Vienna:a pieter$ git status # On branch master # Changed but not updated: # (use "git add/rm <file>..." to update what will be committed) # # deleted: a # This is the point where you were. Look at the line "Changed but no updated" and also the hint "(use "git add/rm <file>..." to update what will be committed)". Vienna:a pieter$ echo "text" >b && git add b && git commit -m "change" Created commit e28a131: change 1 files changed, 1 insertions(+), 0 deletions(-) You changed b and commited it, but did nothing with a. now when you do git status: Vienna:a pieter$ git status # On branch master # Changed but not updated: # (use "git add/rm <file>..." to update what will be committed) # # deleted: a # no changes added to commit (use "git add" and/or "git commit -a") It'll still show it as deleted. And still gives you a hint on what to do (TWICE!). So, let's do that: Vienna:a pieter$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: a # Notice that it now says "Changes to be committed"! If you commit now, your status will be clean: Vienna:a pieter$ git commit -m "deleted a" Created commit 02bbe7b: deleted a 0 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 a Vienna:a pieter$ git status # On branch master nothing to commit (working directory clean) In short, the point is that you never commited the deletions! Your whole history until now will still show those deleted files. You can commit the actually deletions now, as you should have done before (either by using "git rm <file>", "git add -u", "git commit -a" or "git commit <file>". - Pieter