All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carl Worth <cworth@cworth.org>
To: git@vger.kernel.org
Subject: On removing files and "git-rm is pointless"
Date: Sat, 02 Dec 2006 09:05:16 -0800	[thread overview]
Message-ID: <87odqm2ppv.wl%cworth@cworth.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 2150 bytes --]

Some people have recently asked questions about why we even have a
"git rm" command since it seems so pointless if you understand git's
model and "commit -a" well enough.

I wrote that command, so let me explain.

The problem I was trying to address is that a new user (me), was
trying to learn git and made it through a scenario like this:

	git init-db
	echo a > a
	git add a
	git commit

	"Cool, that works. Now let's explore file deletion:"

	rm file
	git commit

	"Hmm... that' didn't work, and git commit says:

		#   (use git-update-index to mark for commit)
		#
		#       deleted:    file

	I explored the documentation and found
	"git update-index --remove file" and thought, "this git system
	is insane! what a horrible command line that is!"

So, with "git commit", it doesn't work to just plain delete the file.

Now, a really cool thing about git and something that makes it easier
than other systems, (like cvs say), is that you don't _have_ to do
anything extra to tell it about file deletion, (nor file rename). But
to get the cool feature to work, you have to use "commit -a":

	rm file
	git commit -a

Is our new documentation going to lead users to discover this great
feature? We're talking about documenting "commit -a" as, "'add' all
tracked files then commit". It would take an exceptional stretch for a
new reader to take that sentence and realize that it would also mean
that any deleted file would also be removed from git's tracking. We're
using a verb with the _opposite_ meaning for crying out loud!

So, back to "git rm". I added it not just because some people might be
trained to tell the SCM about file removal. I added it to make "git
commit" seem more reliable, (since it can feel broken to new
users---it doesn't seem 'smart' enough to just figure out what changes
have been made to files that are being tracked).

So we should show the "smarter" behavior to users by default. Then
"git commit" wouldn't feel broken. We could even throw away "git rm"
and use its absence as a selling point for git. "Hey, git's actually
_easier_ to use than that broken stuff you've been using."

Wouldn't that be great?

-Carl




[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2006-12-02 17:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-02 17:05 Carl Worth [this message]
2006-12-02 17:37 ` On removing files and "git-rm is pointless" Linus Torvalds
2006-12-02 20:00   ` Sam Vilain
2006-12-03  3:50     ` Nicolas Pitre
2006-12-04 10:13       ` Junio C Hamano
2006-12-04 10:48         ` Jakub Narebski
2006-12-04 15:42         ` Linus Torvalds
2006-12-04 16:03           ` Jakub Narebski
2006-12-04 16:04           ` Olivier Galibert
2006-12-05  1:08           ` Junio C Hamano
2006-12-05  3:29             ` Nicolas Pitre
2006-12-05  3:44               ` Carl Worth
2006-12-05  5:43               ` Junio C Hamano
2006-12-02 20:59   ` Horst H. von Brand
2006-12-02 21:10     ` Sam Vilain
2006-12-02 21:33     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87odqm2ppv.wl%cworth@cworth.org \
    --to=cworth@cworth.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.