Renaming in Git and Mercurial: Accuracy and automaticity

I only have a few days of experience with Git and Mercurial, and I don’t have much programming experiences.

In the past few days, I read many posts that comparing the two. Based on what I’ve read and my tests, I get the following conclusions:

  • Git: How to handle git libraries in project
  • Merge commits don't appear in git rebase --interactive
  • Getting fatal: object is corrupted when pushing to a remote repo
  • Can you share a file and it's history between two git repositories?
  • Get a token by Github API
  • VS 2013 + Git + Visual Studio Online + multiple Repos in one project
  • Git’s renaming is 100% automatic but not 100% accurate. It relies on algorithm to guess renames. The end users are not able to alter its decision even if it’s completely wrong.

    I guess Git’s method might be fine for 99% of the cases, but that 1% are going to cause headaches. It makes me hesitate to refactor my code (changing class name and contents at the same time), as I’m risking losing file history if refactor too much.

    Mercurial can be 100% automatic and 100% accurate, as long as I always rename/move my stuffs inside Visual Studio and have VisualHG installed, VisualHG should accurately and automatically track moving and renaming (currently VisualHG has a bug – File is not renamed when I move it between projects). And the end users can change it’s decision if it makes mistakes.

    If I don’t have Visual Studio I can still use TortoiseHg’s “Detect Copies/Renames” window, I can set a similarity percentage, ask Mercurial to automatically detect renames. If it makes mistake, I have the chance to correct it.

    Are my conclusions right or wrong?

    Reference:

    Git and Mercurial – Compare and Contrast

  • How to guerilla VC with git while forced to use CVS at work?
  • How to handle subprojects with autotools?
  • how to tell Git (msysgit on Windows) to use ssh and not pageant
  • What is the difference between Git Bash and the GitHub for Windows shell?
  • Git server hook: get contents of files being pushed?
  • How to remove old versions of media files from a git repository
  • 2 Solutions collect form web for “Renaming in Git and Mercurial: Accuracy and automaticity”

    Here you can see the difference explained, but mostly you are right. Mercurial has rename and mv commands that do “real” renaming, while Git’s mv just does rm and add. Also seems like Mercurial can mimic Git behavior and guess your renames, quite nice feature. From experience Git’s rename detection algorithm makes wrong decisions a lot – especially if you copy a file and alter the two copies a little – most of the time it will be wrong.

    I don’t think that Mercurial’s ability to track file renames is nearly so perfect as you seem to think it might be. I don’t have much experience with Git, but I do have a good bit with Mercurial, and renaming files seems to work OK in some contexts (hg view understands them), so long as you haven’t done anything too “interesting” (which seems to happen somewhat frequently).

    And Git, by reputation at least, is supposed to let you make low-level changes to history if you need to.

    Git Baby is a git and github fan, let's start git clone.