How do I synchronise two remote Git repositories?

Git branches do not have “heads” in the Mercurial sense. There is only one thing called HEAD, and it’s effectively a symlink to the commit you currently have checked out. In the case of hosted repositories like GitHub, there is no commit checked out—there’s just the repository history itself. (Called a “bare” repo.) The reason … Read more

Automatically mirror a git repository

I wrote a post-commit hook for just this purpose. The hook itself is simple; just add a file named post-commit to your .git/hooks/ directory with the following contents: git push my_remote The post-commit file should be executable. Also make sure that you add a suitable remote repository with the name my_remote for this this hook … Read more

Showing renames in hg status?

There are several ways to do this. Before you commit, you can use hg diff –git to show what was renamed: $ hg diff –git diff –git a/theTest.txt b/aTest.txt rename from theTest.txt rename to aTest.txt Note that this only works if you used hg mv, hg rename, or mv and hg addremove –similarity 100. After … Read more

Mercurial with multiple projects

Some subversion repositories will group logically unrelated things (i.e. projects with different version numbers and release cycles) under one trunk: . |– branches | |– project-a-1.x | `– project-a-feature-1 |– tags | |– project-a-1.0 | |– project-b-1.0 | `– project-b-1.1 `– trunk |– project-a `– project-b This kind of layout has no direct analog in … Read more

What’s so great about git?

On the top of my head: its distributed aspect (each developer has a copy of the repository) The ability to handle complex merges very quickly the possibility to switch from task to task, shelve his work, go back to it… cheap branching (instant switch: it just writes a few bits in a file! And it … Read more

Is using a central repository going against GIT’s purpose?

Not really. DCVS just allows more freedom in how to interact between developers without involving the central repository. The official repository is only official by consensus. Linux also has a central repository, the one from which the “official” kernel-releases are created, but there is no physical difference between the central, “official”, repository and client repositories … Read more