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

Re: svn versus git

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Dec 13, 2006, 23:24 UTC
Message-ID
<200612140024.17739.robin.rosenberg.lists@dewire.com>
In-Reply-To
<200612132200.41420.andyparkins@gmail.com>

onsdag 13 december 2006 23:00 skrev Andy Parkins: [...]

Show 14 quoted lines
> svn checkout::
> Checkout a working copy from a repository.  You may check out an
> arbitrary revision.
> git clone::
> git checkout::
> Git, of course, is different from subversion, as the whole repository is
> always available.  git-checkout is nearest in concept to svn-checkout
> though.  It changes the current working directory to a particular
> branch.  You may not checkout an arbitrary revision.  git-clone might
> also be considered as an svn checkout analog.  However,
>
> Subversion wins.  The output from Subversion's checkout is clear.  The
> output from git-clone gives output that is only understandable by
> someone familiar with git internals.

I'd say svn clone is the nearest equivalent as it does the initial fetch of data, no checkout is necessary after clone. it checks out master. Then you git-checkout to switch branch, which corresponds to svn switch.

Show 14 quoted lines
> svn commit::
> Pushes changes to the upstream respository from your working copy.
> git commit -a::
> Saves changes to the working copy as a new revision in the local
> repository.
>
> The need for "-a" (or not) because of git's staging area (the index)
> here makes it more confusing than svn-commit for new users.  However,
> the ability to do "git --amend" more than makes up for it.  Fixing a
> typo in your last log message is difficult in subversion.  Also, git's
> commit message template is much better: both uses the output of their
> status commands which is far clearer in git than in Subversion.
>
> Git wins.

You'll need to push too in order to get a copy in a central repository. git-commit stays locally, and you need a place to push to. If your SVN repo isn't local this does not apply. git gives more freedom here.

Show 8 quoted lines
> svn copy::
> Duplicate something in working copy or repository, remembering history.
> cp A B; git add B::
> Git doesn't have a direct equivalent of svn copy.  It's arguable whether
> it needs it once the user knows they can git-add so easily.
>
> Git wins.  Git's ability to detect copies after-the-fact, mean that a
> git-copy isn't necessary.

svn copy is more like git checout -b, i.e. it's primary purpose is not to "copy" things, it is to create branches. You generally do not copy code (I hope).

Show 12 quoted lines
> svn move::
> Move and/or rename something in working copy or repository.
> git-mv::
> Move or rename a file, directory or symlink.
>
> Git wins.  The two are equivalent except that git can do multiple moves
> in one command, just like normal "mv".  So "git mv src/* newsrc/" works
> while "svn mv src/* newsrc/" doesn't.  Additionally, if you forget to do
> moves with git and instead use the command line, you can easily use
> "update-index" to tell git about the move after the fact.  In subversion
> you have to undo all the moves and do them again with subversion.  This
> makes it inconvenient to use tools like "rename" to do regexp moves.
In svn this also renames a branch.
Show 10 quoted lines
> svn switch::
> Update the working copy to a different URL.
> [no git equivalent]::
> git is distributed and can fetch from any number of remote repositories.
> The URL can be typed on the command line of git-fetch, or can be given a
> shortcut as a "remote".  If we're talking about a single repository
> (which we have to to compare against subversion), the repository is
> local anyway.
>
> Git wins.  Command is unnecessary.

svn switch corresponds to git-checkout. I don't think you can change the URL unless the new URL actually points to the same repository.

> Discussion
> ----------
[...]
Show 8 quoted lines
>  - svn revert: it's not easy to revert a single file in git; especially
>    once we bring the index into play.  Restoring a single file in the index
>    to HEAD while leaving the rest of the index AND the working directory
>    untouched requires something like
>    ----------------------------------------------------
>    git-ls-tree file | git-update-index --index-info
>    ----------------------------------------------------
>    Which isn't simple enough for a typical user.

Typically the user want to restore the index AND the working directory. Comparing typical workflows is more interesting than finding exact equivalents.

Previous: Jakub NarebskiNext: Junio C Hamano
Message 34 of 43 in “svn versus git”
  1. Andy ParkinsDec 13, 2006
  2. J. Bruce FieldsDec 13, 2006
  3. Document the simple way of using of git-cat-fileRobin Rosenberg, Dec 13, 2006
  4. Jakub NarebskiDec 13, 2006
  5. Johannes SchindelinDec 14, 2006
  6. Jakub NarebskiDec 14, 2006
  7. Jakub NarebskiDec 13, 2006
  8. Andy ParkinsDec 13, 2006
  9. Jakub NarebskiDec 13, 2006
  10. Shawn PearceDec 13, 2006
  11. Peter BaumannDec 13, 2006
  12. Shawn PearceDec 13, 2006
  13. Jakub NarebskiDec 13, 2006
  14. Shawn PearceDec 13, 2006
  15. Andy ParkinsDec 14, 2006
  16. Junio C HamanoDec 14, 2006
  17. Andy ParkinsDec 14, 2006
  18. Nguyen Thai Ngoc DuyDec 14, 2006
  19. Johannes SchindelinDec 14, 2006
  20. Nguyen Thai Ngoc DuyDec 14, 2006
  21. Johannes SchindelinDec 14, 2006
  22. Nguyen Thai Ngoc DuyDec 14, 2006
  23. Johannes SchindelinDec 15, 2006
  24. Nguyen Thai Ngoc DuyDec 15, 2006
  25. Johannes SchindelinDec 15, 2006
  26. Johannes SchindelinDec 15, 2006
  27. Junio C HamanoDec 15, 2006
  28. Nicolas PitreDec 15, 2006
  29. Nguyen Thai Ngoc DuyDec 16, 2006
  30. Jakub NarebskiDec 15, 2006
  31. Andy ParkinsDec 15, 2006
  32. Seth FalconDec 14, 2006
  33. Jakub NarebskiDec 15, 2006
  34. Robin RosenbergDec 13, 2006
  35. Junio C HamanoDec 13, 2006
  36. Andy ParkinsDec 14, 2006
  37. Arkadiusz MiskiewiczDec 14, 2006
  38. Andreas EricssonDec 14, 2006
  39. Arkadiusz MiskiewiczDec 14, 2006
  40. Shawn PearceDec 14, 2006
  41. Andreas EricssonDec 15, 2006
  42. Johannes SchindelinDec 14, 2006
  43. Jakub NarebskiDec 15, 2006

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.