From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xue Fuqiao Newsgroups: gmane.emacs.devel Subject: Re: Git question: when using branches, how does git treat working files when changing branches? Date: Thu, 29 Oct 2015 06:56:14 +0800 Message-ID: References: <20151028192017.GC2538@acm.fritz.box> <87k2q6wy8p.fsf@linaro.org> <20151028223252.GD2538@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1446073003 3728 80.91.229.3 (28 Oct 2015 22:56:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Oct 2015 22:56:43 +0000 (UTC) Cc: =?UTF-8?B?QWxleCBCZW5uw6ll?= , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 28 23:56:29 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZrZdt-0004Jb-JH for ged-emacs-devel@m.gmane.org; Wed, 28 Oct 2015 23:56:29 +0100 Original-Received: from localhost ([::1]:41029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrZds-0000LR-Sp for ged-emacs-devel@m.gmane.org; Wed, 28 Oct 2015 18:56:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrZdf-0000KS-Mg for emacs-devel@gnu.org; Wed, 28 Oct 2015 18:56:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrZde-00024e-Q0 for emacs-devel@gnu.org; Wed, 28 Oct 2015 18:56:15 -0400 Original-Received: from mail-ig0-x22e.google.com ([2607:f8b0:4001:c05::22e]:36333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrZde-00024a-Ln for emacs-devel@gnu.org; Wed, 28 Oct 2015 18:56:14 -0400 Original-Received: by igdg1 with SMTP id g1so119007900igd.1 for ; Wed, 28 Oct 2015 15:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZX0FffRjr6K5un20X8A9Z/LzUhRSOfVHbJSULSkwpSg=; b=SDjraCxJExsOA1TZFcxb+9rCvHhFizR4qAuwV1FgIGJ9H9Q/dvRtgjervEZ7nRn21J 0JgmpWDJXvNmyqqIgl+1NFMrg4N+rihrkE8odJz1sGv2t8JdsF+MrC9Cm1et7wGzXQOF iYljpMprjY0LzGmgIvReF3Bt/NcbWzmkObiL59WuZPwVZrr1LQZO4HIcDIG0+o3RZFYA 3S3JQSDo81N9NH+Dq/nHHf/Ib2Qs+j+jyTBM96nznB4/u4OwfCNdifO8xEG6SqVIAzIM ScoXoeXP37PYiPjdUaQZQt+cJNiYAemJCn6N9d98+fFeGt1BqfgaaZ3au49fy0HZ1hf4 ay/Q== X-Received: by 10.50.117.65 with SMTP id kc1mr6338434igb.4.1446072974292; Wed, 28 Oct 2015 15:56:14 -0700 (PDT) Original-Received: by 10.79.94.2 with HTTP; Wed, 28 Oct 2015 15:56:14 -0700 (PDT) In-Reply-To: <20151028223252.GD2538@acm.fritz.box> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c05::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:192833 Archived-At: Hi Alan, On Thu, Oct 29, 2015 at 6:32 AM, Alan Mackenzie wrote: > OK, I started with a test repository, with some changes in (which I saved > in a diff file). After listing the available branches, and chosing one > at random, I did > $ git checkout /origin/master It should be `git checkout origin/master' or `git checkout refs/remotes/origin/master'. > , and got some message or other about a detached head. Without doing > anything else I then switched back with > $ git checkout master. > > git status now reports that the working directory is "clean". So one of > these two operations has discarded my changes. I don't think something like `/origin/master' should be in your output of `git branch', unless you used the -r or -a option. And one usually shouldn't work in the 'detached HEAD' state, unless he/she would like to discard the changes later, or want to create a new branch. Well, this isn't really an answer to your question. Just some corrections/suggestions.