|
|
Subscribe / Log in / New account

Subversion 1.8.0 released

Subversion 1.8.0 released

Posted Jun 23, 2013 2:03 UTC (Sun) by jimparis (guest, #38647)
In reply to: Subversion 1.8.0 released by mathstuf
Parent article: Subversion 1.8.0 released

"git checkout" is a particularly easy to way lose data.
While true, it will fail of git can't reapply your local changes.

No, I'm referring to running git checkout file when file has unstaged changes. Git irrevocably clobbers file with the original copy without confirmation. And that is made significantly worse by the fact that git checkout branch is a common non-destructive operation. It means that a small brain fart while trying to do something non-destructive (checkout a branch) can easily destroy data (checkout a file).


to post comments

Subversion 1.8.0 released

Posted Jun 23, 2013 4:09 UTC (Sun) by jedbrown (subscriber, #49919) [Link] (5 responses)

If the file was staged, you can find it with 'git fsck'. If it wasn't staged, then there were plenty of other ways to lose that file. Regardless, also check for your editor's backup file before conceding defeat.

Subversion 1.8.0 released

Posted Jun 23, 2013 6:15 UTC (Sun) by dlang (guest, #313) [Link] (3 responses)

what version control system won't overwrite files if you do a checkout?

picking on git for doing so seems odd.

Subversion 1.8.0 released

Posted Jun 23, 2013 17:21 UTC (Sun) by jimparis (guest, #38647) [Link]

what version control system won't overwrite files if you do a checkout?

picking on git for doing so seems odd.

I'm picking on git because git checkout file and git checkout branch are too similar. It's too easy to do the wrong thing.

Say you have two branches with an identical file. You edit the file, then realize you wanted to commit to the other branch. So you might do this, which is fine:

$ emacs build.txt
$ git checkout build
$ git add build.txt
$ git commit -m 'updated build'
But this loses your edits:
$ emacs build.txt
$ git checkout build.txt
$ git add build.txt
$ git commit -m 'updated build'
I've had that second one happen to me when I thought tab-completion would fill in branch names, but it completed filenames instead. It's not a big deal, I'm just pointing it out as an example of how git can lose data other than "reset --hard" and scattered "-f". I still greatly prefer git to anything else.

Subversion 1.8.0 released

Posted Jun 23, 2013 22:23 UTC (Sun) by marcH (subscriber, #57642) [Link]

> what version control system won't overwrite files if you do a checkout?

None. This is about the one that makes it the easiest.

Subversion 1.8.0 released

Posted Jun 24, 2013 9:38 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link]

CVS creates backup files in this case. SVN would simply refuse to overwrite files without an explicit "force" switch.

"git checkout" is really one of the dumbest ideas in Git.

Subversion 1.8.0 released

Posted Jun 23, 2013 10:29 UTC (Sun) by dark (guest, #8483) [Link]

Speaking of not conceding defeat, I have been known to grep through /dev/sda to find lost files :) It can work if they're short enough to fit in a few blocks.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds