How and when do Mercurial or git diff files?

I am on a project about file sync. I have some questions:

  • Who can tell me how Mercurial or Git diff files and store the diffs?
  • Does it monitor file change?
  • Does it need to diff the whole file when making a commit?
  • Whether it can monitor the change of section by driver?
  • What’s the differences between the way of processing text files and binary files?
  • Is there any other opensource software that I should to research?

  • git merge from subtree folder in master to branch root
  • Creating satis composer private repository for wordpress themes and plugins
  • Git is not tracking changes to a .rdb redis db file?
  • How is git push through network working? (proxy)
  • How to migrate to Git from this setup (svn)
  • How can I rename a git repository with submodules?
  • Can't log in to Github for Mac client after changing my computer's name
  • Git excludesfile for a branch
  • Unable to install gclient command in ubuntu 14.04
  • beyond compare with `git difftool --dir-diff` — Hitting an issue with sym-links
  • Git: How to apply the same modifications to another branch?
  • Hide or delete a non-existant folder from git terminal
  • One Solution collect form web for “How and when do Mercurial or git diff files?”

    For Mercurial, it differs between showing a diff, and storing the diff.

    When showing the diff, it depends on whether you ask Mercurial itself to show the diff, or if you ask it to use an external diff program.

    Here are all the combinations:

    1. Storing the diff
      1. Always uses binary diff, does not matter what kind of file it is (or is assumed to be)
    2. Showing the diff
      1. Asking Mercurial to show the diff
        1. Will complain if it is a binary file (that is, that Mercurial assumes it is a binary file)
        2. Will show the diff if it is a text file (again, assumed)
      2. Asking external program to show the diff
        1. Depends on what that external program is able to handle

    As for monitoring the changes, Mercurial does not do this. When you ask it to commit, at that point it figures out which files to store and what changes to commit for them.

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