[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Git question: when using branches, how does git treat working files
From: |
Óscar Fuentes |
Subject: |
Re: Git question: when using branches, how does git treat working files when changing branches? |
Date: |
Wed, 28 Oct 2015 23:59:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Alan Mackenzie <address@hidden> writes:
Joining the emacs-devel git hot line...
>> By default git will complain if changing branches would revert
>> uncommitted changes.
>
> 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
> , 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.
This is hard to believe, so I tried your steps:
address@hidden:~/dev/emacs/emacs$ git checkout /origin/master
fatal: Could not switch to '/origin/': No such file or directory
As you can see, your first command fails to complete. I requested this
on a previous question of yours about git and I request it again: please
post the *exact* commands and its output. Otherwise, claims like what
you made above are dubious, at best.
[snip]
>> Well I usually do a stash/rebase/stash-pop cycle in magit. However you
>> may want to look at the rebase.autostash option (since Git 2.6)
>
> The problem is that, according to David K, there's only one stash stack,
> so it would be very inconvenient having to keep track of which entries in
> this stack belong to which branches.
David Kastrup also suggested to commit your changes before switching
branches, I wonder why you ignored his advice.
Over the years I used several VC systems (CVS and subversion, among
others) and git is, by far, the one that makes things easier when you
don't want to lose your changes, committed or not.
Finally, I wholeheartedly recommend to give Magit a try.
[snip]
- Git question: when using branches, how does git treat working files when changing branches?, Alan Mackenzie, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Steinar Bang, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Ricardo Wurmus, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Alex Bennée, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Alan Mackenzie, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Xue Fuqiao, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?,
Óscar Fuentes <=
- Re: Git question: when using branches, how does git treat working files when changing branches?, Alan Mackenzie, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Dmitry Gutov, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Michael Heerdegen, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Michael Heerdegen, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, Yuri Khan, 2015/10/28
- Re: Git question: when using branches, how does git treat working files when changing branches?, David Kastrup, 2015/10/29
- Re: Git question: when using branches, how does git treat working files when changing branches?, Alan Mackenzie, 2015/10/29
- Re: Git question: when using branches, how does git treat working files when changing branches?, David Kastrup, 2015/10/29
- On the popularity of git [Was: Git question: when using branches, how does git treat working files when changing branches?], Alan Mackenzie, 2015/10/29
- Re: On the popularity of git [Was: Git question: when using branches, how does git treat working files when changing branches?], David Kastrup, 2015/10/29