git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Howard Miller <howardsmiller@googlemail.com>
To: Mikko Oksalahti <mikko@azila.fi>
Cc: git@vger.kernel.org
Subject: Re: Newbie "svn update" question
Date: Tue, 1 Dec 2009 09:45:20 +0000	[thread overview]
Message-ID: <26ae428a0912010145k61dbfc41l8243363493918445@mail.gmail.com> (raw)
In-Reply-To: <loom.20091201T101313-496@post.gmane.org>

2009/12/1 Mikko Oksalahti <mikko@azila.fi>:
> Hi,
>
> I just started using git for my personal projects at home. Basic usage seems
> pretty straight-forward as well as setting up everything. However, I have a
> simple question about how do I mimic an "svn update" command on a locally
> created repository. Here's what I do:
>
> some_existing_project_dir> git init
> some_existing_project_dir> git add .
>
> (about 1000 files added...)
>
> some_existing_project_dir> git commit -a -m "initial commit"
>
> (now I edit 10 files and accidentally delete some files that I'm not aware of)
>
> How do I now get the accidentally deleted files back from the repository without
> losing local changes made to 10 files?
>
> I've tried using: "git checkout HEAD ." but my local changes after last commit
> will be lost.
>
> I've tried using: "git pull ." but the deleted files are not restored.
>
> So I'm looking for an "svn update" equivalent command that would semantically do
> this: "Get the latest version of all files from the repository and merge them
> with any local changes I've made to files."
>
> I know a suitable command is available and I'm just a moron who can't read the
> manual correctly but help me out anyway :P
>
>  Regards,
>     Mikko

'git status' should show you what files you have deleted.  'git
checkout filename' should get them back. I can't think of a way of
recovering every file you have just deleted although - I suspect it
might be tricky. Thinks like 'git pull' only apply to remote
repositories and you don't have one of those. You're not thinking of
it the right way (yet) :-)

Howard

  reply	other threads:[~2009-12-01  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01  9:25 Newbie "svn update" question Mikko Oksalahti
2009-12-01  9:45 ` Howard Miller [this message]
2009-12-01 12:00   ` Newbie Mikko Oksalahti
2009-12-01  9:49 ` Newbie "svn update" question Tay Ray Chuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26ae428a0912010145k61dbfc41l8243363493918445@mail.gmail.com \
    --to=howardsmiller@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=mikko@azila.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).