Re: [git-users] Recover partially ignored file deleted by branch checkout?

2018-11-03 Thread 'Matthias Urlichs' via Git for human beings
On 03.11.18 09:40, j...@tcs.ifi.lmu.de wrote:
> @Matthias Urlichs: The file had been comitted to the repository
> initially. It was only added to .gitignore much later on, when other
> users complained.

Ah. Sorry, I missed that.

You're right – this is a bug. My reasoning for that assessment is that
if you check out any commit before the one that added the
currently-ignored file and *then* check out the "problem" commit with
the old version, you get an error message. However, intermediate
checkout steps should not affect the result.

Please submit an issue.

-- 
-- Matthias Urlichs

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Recover partially ignored file deleted by branch checkout?

2018-11-03 Thread jost
@Matthias Urlichs: The file had been comitted to the repository initially. 
It was only added to .gitignore much later on, when other users complained.

@Philip Oakley: The files in question are local configuration files (for my 
editor, which contained private ssh settings for testing the code that 
should not be in a coding repository)

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Recover partially ignored file deleted by branch checkout?

2018-11-02 Thread Philip Oakley

> The file is added to .gitignore


I'm not sure why this step of adding the name of an important file to 
the ignore list was added. To me, that sounds a bit backward. Usually, 
an important file would not be listed in the ignore file.



Would you be able to expand on the reason for the adding to the ignore 
list, and maybe what the file type was.



I suspect that unfortunately you have probably lost the file as git 
trusted the assertion that it was ignorable (which is a slight problem 
with Git's 'run with scissors' approach to certain things (like trusting 
the devs assertions, and assuming dumb mistakes are also trustable) .



The idea of 'precious' files keeps on repeating on the Git list 
(https://public-inbox.org/git/?q=precious+files), but there hasn't been 
any successful discussions.



On 02/11/2018 17:12, j...@tcs.ifi.lmu.de wrote:

Hi!

A checkout deleted a partially untracked file. Is there a way to 
recover the file? What did I do wrong?


The problem is likely due to .gitignore being checked in and changing 
across branches:


  * A stub for a new file is created, committed and pushed.
  * The file is added to .gitignore and "git rm --cached file" is
executed since only I need that file.
  * Several commits to that branch happen. The file is heavily edited,
but ignored by commits as expected.
  * After commit, pull and push; I checkout another (old) branch,
which has not seen the commit that changes .gitignore
  * No changes, and I checkout the previous branch again. However, now
my file seem irrevocably lost. The remote repository only contains
the initial stub for this file, since it was only edited after it
was being added to .gitignore

I usually advise my students to check-in their .gitignore file into 
the repository. Apparently this is a bad advice, since it now seemed 
to have led to a file loss. So what is the advice on this? Google 
turned up mixed advice there, but I could not find a reference to my 
problem described above.


Thanks for any advice,
 Steffen.
--
You received this message because you are subscribed to the Google 
Groups "Git for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to git-users+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Recover partially ignored file deleted by branch checkout?

2018-11-02 Thread 'Matthias Urlichs' via Git for human beings
On 02.11.18 18:12, j...@tcs.ifi.lmu.de wrote:
> The file is heavily edited, but ignored by commits as expected.

Last time I checked (which was half a minute ago), files in .gitignore
are only ignored for the purpose of not adding them to the archive.

Modifying such a file, editing it, and then "git commit -a"ing the
archive will, however, check in your changes. Thus your scenario does
not happen.

$  git init
$  echo a >a
$  git add a

$  git commit -m Initial
$  echo b >b
$  echo b >.gitignore
$  git add -f .gitignore b
$  git commit -m NoB
$  echo bla >b
$  git commit -a -m foo

$ git show

commit 1b60a5792732e45c685bcced51b6c754d9833530 (HEAD -> master)
Author: Matthias Urlichs 
Date:   Fri Nov 2 20:10:43 2018 +0100

    foo

diff --git a/b b/b
index 6178079..a7f8d9e 100644
--- a/b
+++ b/b
@@ -1 +1 @@
-b
+bla

$

-- 
-- Matthias Urlichs


-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


[git-users] Recover partially ignored file deleted by branch checkout?

2018-11-02 Thread jost
Hi! 

A checkout deleted a partially untracked file. Is there a way to recover 
the file? What did I do wrong?

The problem is likely due to .gitignore being checked in and changing 
across branches:

   - A stub for a new file is created, committed and pushed.
   - The file is added to .gitignore and "git rm --cached file" is executed 
   since only I need that file.
   - Several commits to that branch happen. The file is heavily edited, but 
   ignored by commits as expected.
   - After commit, pull and push; I checkout another (old) branch, which 
   has not seen the commit that changes .gitignore
   - No changes, and I checkout the previous branch again. However, now my 
   file seem irrevocably lost. The remote repository only contains the initial 
   stub for this file, since it was only edited after it was being added to 
   .gitignore

I usually advise my students to check-in their .gitignore file into the 
repository. Apparently this is a bad advice, since it now seemed to have 
led to a file loss. So what is the advice on this? Google turned up mixed 
advice there, but I could not find a reference to my problem described 
above.

Thanks for any advice,
 Steffen.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.