git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: Mikko Oksalahti <mikko@azila.fi>
Cc: git@vger.kernel.org
Subject: Re: Newbie "svn update" question
Date: Tue, 1 Dec 2009 17:49:59 +0800	[thread overview]
Message-ID: <be6fef0d0912010149o5b5d0557xfb8c57e4a29e4d7e@mail.gmail.com> (raw)
In-Reply-To: <loom.20091201T101313-496@post.gmane.org>

Hi

On Tue, Dec 1, 2009 at 5:25 PM, Mikko Oksalahti <mikko@azila.fi> wrote:
> 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."

Are you looking for a command that

  "Restore deleted files, without reverting local changes",

or

  "Get the latest version of all files from the repository and merge
them with any local changes I've made to files."?

I would suggest adding the changed files, then doing a checkout.

  git add changed.file1
  git add changed.file2
  git add -p #alternatively, select hunks/changes to add interactively
  git checkout HEAD #although using . (current directory) should give
the same result

Note that your changes have only been added to the index, and you need
to commit them. The index/stage is a concept not in svn. See the user
manual for more on this.

I also suspect you are still thinking in svn mode when you said
getting the latest version from the repository. You already have a
repository locally. It is more an issue of syncing your local
repository with the one that you're following. Unlike svn, every time
you commit, your local repository is updated, not the remote one, and
vice-versa.

-- 
Cheers,
Ray Chuan

      parent reply	other threads:[~2009-12-01  9:50 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
2009-12-01 12:00   ` Newbie Mikko Oksalahti
2009-12-01  9:49 ` Tay Ray Chuan [this message]

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=be6fef0d0912010149o5b5d0557xfb8c57e4a29e4d7e@mail.gmail.com \
    --to=rctay89@gmail.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).