From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Git question: when using branches, how does git treat working files when changing branches? Date: Wed, 28 Oct 2015 19:20:17 +0000 Message-ID: <20151028192017.GC2538@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1446059991 16697 80.91.229.3 (28 Oct 2015 19:19:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Oct 2015 19:19:51 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 28 20:19:42 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 1ZrWG6-0006Cv-4N for ged-emacs-devel@m.gmane.org; Wed, 28 Oct 2015 20:19:42 +0100 Original-Received: from localhost ([::1]:40324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrWG5-0004rR-6i for ged-emacs-devel@m.gmane.org; Wed, 28 Oct 2015 15:19:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrWF5-0003x0-4w for emacs-devel@gnu.org; Wed, 28 Oct 2015 15:18:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrWF1-0007Gr-RI for emacs-devel@gnu.org; Wed, 28 Oct 2015 15:18:39 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:35686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrWF1-0007F7-H5 for emacs-devel@gnu.org; Wed, 28 Oct 2015 15:18:35 -0400 Original-Received: (qmail 36581 invoked by uid 3782); 28 Oct 2015 19:18:33 -0000 Original-Received: from acm.muc.de (p579E8681.dip0.t-ipconnect.de [87.158.134.129]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 28 Oct 2015 20:18:32 +0100 Original-Received: (qmail 12948 invoked by uid 1000); 28 Oct 2015 19:20:18 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:192813 Archived-At: Hello, Emacs. I want to start using git branches, so as to be able to work on several distinct things at the same time. My question is, how does git handle working files (which haven't been committed) when changing from one branch to another. I've spent the usual two hours searching the fine manuals without turning up a clear explanation. One thing that worries me is that the same command "git checkout" is used to change branches and to revert changes to a file. So it seems plausible that each time I swap to a different branch I'm in danger of irrevocably losing existing changes to source files. So, what happens to to changes in the working directory when changing branches? 1. git refuses to change branches because there are uncommitted changes. 2. git changes branches, discarding all uncommitted changes. 3. git changes branches, leaving the changes from the previous branch in the working directory. What I really want to happen is 4. git maintains uncommitted changes separately in each branch. I suspect 4. is not the way git works. So, how do I best simulate 4.? I would like to be able to move freely between git branches without suffering stupid restrictions like having to worry about preserving changes in the working directory. Is there some variant of "git stash" which might do what I want? TIA! -- Alan Mackenzie (Nuremberg, Germany).