Re: git-rm isn't the inverse action of git-add

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yann Dirson
Date: Monday, July 2, 2007 - 1:40 pm

On Mon, Jul 02, 2007 at 10:23:00PM +0200, Christian Jaeger wrote:

I'd say it does so, so you won't loose any uncommitted changes without
knowing it - and "git add -f" is available when you have checked that
you indeed want to discard that data.


It already works as such: it will warn you if you have already staged
the file in the index, but it has not been committed, in which case
the data would be lost as well:

$ echo foo > bar
/tmp/test$ git rm bar
fatal: pathspec 'bar' did not match any files
/tmp/test$ git add bar
/tmp/test$ git rm bar
error: 'bar' has changes staged in the index (hint: try -f)

That is, "git rm" will only ever remove the file without asking, when
it is safe do so, in that you can retrieve your file from history.  Or
do you think of another way, in which more safety would be needed ?

Best regards,
-- 
Yann
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-rm isn't the inverse action of git-add, Christian Jaeger, (Mon Jul 2, 11:09 am)
Re: git-rm isn't the inverse action of git-add, Yann Dirson, (Mon Jul 2, 12:42 pm)
Re: git-rm isn't the inverse action of git-add, Christian Jaeger, (Mon Jul 2, 1:23 pm)
Re: git-rm isn't the inverse action of git-add, Yann Dirson, (Mon Jul 2, 1:40 pm)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Mon Jul 2, 1:54 pm)
Re: git-rm isn't the inverse action of git-add, Johannes Schindelin, (Mon Jul 2, 2:05 pm)
Re: git-rm isn't the inverse action of git-add, Christian Jaeger, (Mon Jul 2, 2:20 pm)
Re: git-rm isn't the inverse action of git-add, Jeff King, (Mon Jul 2, 9:12 pm)
Re: git-rm isn't the inverse action of git-add, Junio C Hamano, (Mon Jul 2, 9:47 pm)
Re: git-rm isn't the inverse action of git-add, Jeff King, (Mon Jul 2, 9:59 pm)
Re: git-rm isn't the inverse action of git-add, Junio C Hamano, (Mon Jul 2, 10:09 pm)
Re: git-rm isn't the inverse action of git-add, Jeff King, (Mon Jul 2, 10:12 pm)
Re: git-rm isn't the inverse action of git-add, Junio C Hamano, (Mon Jul 2, 11:26 pm)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Tue Jul 3, 3:37 am)
Re: git-rm isn't the inverse action of git-add, Johannes Schindelin, (Tue Jul 3, 5:09 am)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Tue Jul 3, 6:40 am)
Re: git-rm isn't the inverse action of git-add, Johannes Schindelin, (Tue Jul 3, 7:21 am)
Re: git-rm isn't the inverse action of git-add, Jan Hudec, (Wed Jul 4, 1:08 pm)
Re: git-rm isn't the inverse action of git-add, Matthieu Moy, (Thu Jul 5, 6:44 am)
Re: [RFC][PATCH] Re: git-rm isn't the inverse action of gi ..., Johannes Schindelin, (Sun Jul 8, 11:10 am)
Re: [RFC][PATCH] Re: git-rm isn't the inverse action of gi ..., Johannes Schindelin, (Sun Jul 8, 2:49 pm)