On Thu, 2015-03-12 at 13:24 -0700, William Lasiewicz wrote:
> Here is what I have seen,  but perhaps I am doing something wrong.  

> 1.  Set up a new repository.
> 2.  Add a bunch of files.
> 3.  Commit,  push.
> 4.  Delete your local files.
> Your code is now gone.  All the push commit did is update a text file
> on the server.
> Is this tool that horrible,  or did I do something wrong?

Your description of what you did is not detailed enough for us to say
for sure.

When you say "set up a new repository", do you mean you cloned a
repository from somewhere with "git clone"?  Or do you mean you ran "git
init" in a new directory you'd created?  Since you refer to a "server"
I'm going to assume you ran "git clone".

When you say you ran "push", I assume that it succeeded?  If so then
your changes are safely stored on the server: nothing has been lost.

I'm not sure what you mean by "all the push command did was update a
text file on the server"... you should never be looking inside the .git
directory of any repository: either your local one or the one on the
server.  The content inside there is compressed and compacted, for
efficiency and speed.  You cannot look in there with any non-git tool
(editor, etc.) and find your changes.  But they ARE there.

You may be taken aback by how fast Git is, and fooled into think it
didn't really do anything.  Trust us, it really did, and it really is
that fast.

When you say "delete your local files", do you mean you deleted files in
the directory, but not the local .git directory?  Or did you delete the
entire workspace you had cloned?

If you provide a sequence of Git commands you ran, instead of a general
description, THEN we can describe what's happening correctly.

If you deleted just the local files but not the local .git directory,
then they are still present in the local .git directory: you can recover
them with the "git reset" command, for example:

   $ ls -a

   $ git reset --hard HEAD

   $ ls
     ... all files present ...

If you deleted your entire workspace you can get back all changes you
had successfully pushed by re-running the clone command you used

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.

Reply via email to