git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff Jenkins <Jeff@ShopWiki.com>
To: git@vger.kernel.org
Subject: checkout and rm
Date: Thu, 6 Sep 2007 22:59:14 -0400	[thread overview]
Message-ID: <4F2CF06E-CCC6-4597-A1BF-663BC36B9A94@ShopWiki.com> (raw)

I couldn't find a thread in the archive about this.  Here's the  
abbreviated scenario:

$ git add bar.c
$ git-rm foo.c
rm 'foo.c'
$ git-status
# On branch FOO
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   bar.c
#       deleted:    foo.c
#

$ git-checkout master
M       bar.c
Switched to branch "master"
$ git-status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   bar.c
#

When I change branches:
- the modified files in the index/working directory stay there  
(that's fine)
- the *removed* files are re-added to the working directory when the  
branch changes
- the remove entries aren't in the index anymore

There was no warning about any the lost changes, and if the intent  
was to commit these changes to master because you were in FOO by  
accident, then only some would be committed if you weren't paying  
close attention.  If working directory/index changes are going to be  
kept when a branch switch is done, then the remove changes should be  
propagated as well.

Ideally there would be a config setting which would stop checkouts if  
the working directory or index were dirty (and a flag on checkout  
which overrode the setting).    With stash in 1.5.3 the only reason I  
can think of to allow working directory changes to propagate is gone  
(though i haven't tested how stash works with rm'd files).  At the  
very least, there should be a warning and a prompt if some of the  
changes are going to vanish by a user action

-Jeff Jenkins

             reply	other threads:[~2007-09-07  3:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-07  2:59 Jeff Jenkins [this message]
2007-09-07 22:00 ` checkout and rm Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=4F2CF06E-CCC6-4597-A1BF-663BC36B9A94@ShopWiki.com \
    --to=jeff@shopwiki.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).