From: Peter Vereshagin <peter@vereshagin.org>
To: git@vger.kernel.org
Subject: checkout from neighbour branch undeletes a path?
Date: Tue, 13 Nov 2012 19:23:41 +0400 [thread overview]
Message-ID: <20121113152341.GC6561@external.screwed.box> (raw)
Hello.
Am wondering if 'checkout branch path' undeletes the files? For the example
below I'd like the 'file00.txt' to be deleted and never checked out from the
previous branch... How can I do that?
$ git init
Initialized empty Git repository in /tmp/repo00/.git/
$ mkdir pathdir
$ echo test00 > pathdir/file00.txt
$ git add pathdir
$ git commit -am 'added file00.txt'
[master (root-commit) d4f7c70] added file00.txt
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 pathdir/file00.txt
$ git branch -m master branch00
$ git branch branch01
$ rm pathdir/file00.txt
$ echo test01 > pathdir/file01.txt
$ git add pathdir
$ git status
$ git commit -am 'added file01.txt; removed file00.txt'
[branch00 c3e78ff] added file01.txt; removed file00.txt
2 files changed, 1 insertions(+), 1 deletions(-)
delete mode 100644 pathdir/file00.txt
create mode 100644 pathdir/file01.txt
$ git checkout branch01
Switched to branch 'branch01'
$ rm -r pathdir
$ git checkout branch00 pathdir
$ find pathdir/
pathdir/
pathdir/file00.txt
pathdir/file01.txt
$
I know about 'merge' and it's not the what I need: to import only the
particular subdirectory from the previous branch.
Thank you.
--
Peter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627
next reply other threads:[~2012-11-13 15:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 15:23 Peter Vereshagin [this message]
2012-11-13 16:43 ` checkout from neighbour branch undeletes a path? Junio C Hamano
2012-11-13 18:34 ` Peter Vereshagin
2012-11-13 23:41 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121113152341.GC6561@external.screwed.box \
--to=peter@vereshagin.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 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 NNTP newsgroup(s).