git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Newbie "svn update" question

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Dec 1, 2009, 09:49 UTC
Message-ID
<be6fef0d0912010149o5b5d0557xfb8c57e4a29e4d7e@mail.gmail.com>
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:
Show 11 quoted lines
> 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
Previous: Mikko Oksalahti
Message 4 of 4 in “Newbie "svn update" question”
  1. Mikko OksalahtiDec 1, 2009
  2. Howard MillerDec 1, 2009
  3. Mikko OksalahtiDec 1, 2009
  4. Tay Ray ChuanDec 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.