lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11]


From: Greg Chicares
Subject: Re: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11]
Date: Wed, 11 Jan 2017 21:47:38 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.5.1

On 2017-01-11 18:00, Vadim Zeitlin wrote:
> On Wed, 11 Jan 2017 09:50:41 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC> are these:
> GC>   git reset --hard HEAD
> GC>   git checkout -- .
> GC> equally likely to throw away a useful local change that I had forgotten
> GC> about (so that I wouldn't have moved it to trash)?
> 
>  Yes, "git checkout -- ." is dangerous too and, unless I'm missing
> something, isn't really different from "git reset --hard" if you have no
> saved changes in the index. I tend to avoid using "." with "git checkout
> --" and use it only with the individual files, IMHO it's much simpler to
> accidentally do "git checkout -- ." than "git reset --hard", but maybe it's
> just because I trained myself to subconsciously pause whenever I type
> "--hard" and ask myself whether I'm sure of what I'm doing.

I had trained myself to avoid git-reset and instead to use git-checkout
and specify the name of each file I'm absolutely sure I want to restore.
Tab completion makes it pretty easy to do this.

Then yesterday I wanted to do git-checkout to undo changes to about thirty
files. In that case, entering the names, even with tab completion, is too
much work, so I looked for a faster way and was surprised to learn I could
just type '.'. But, as I later feared, it's not really much different from
git-reset.

> GC> And now I read about 'git checkout --patch', which sounds safer;
> 
>  I admit I hadn't even known about this option but now that I do know about
> it, I don't see what does it do -- isn't it redundant when the path is
> specified?

The documentation says:
  git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>…​
so, to test it out, I tried:
  git checkout --patch -- ledger_base.cpp
That presented me with something that looks like `git diff ledger_base.cpp`,
and it walked through each hunk, asking:
  Discard this hunk from worktree [y,n,q,a,d,/,K,g,e,?]? n
so I guess it could conceivably be useful for undoing changes to the files
in <pathspec> selectively.

Without <pathspec>, it does the same thing, but for all files.

Neither really suits me. Most often I want to undo either all the changes
in a particular file, or none. I was hoping it might prompt me for file
names only. Let's see--the options are the same as for git-add's
interactive mode, but with different meanings, e.g.:
  a - discard this hunk and all later hunks in the file
I guess I could type 'a' to discard the whole file, but then I'd have to
remember that it means
  a - stage this hunk and all later hunks in the file
with git-add.

It's reasonably designed, but it's just not the way I work, so I don't
want to learn it after all.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]