Darcs and Git are both fine distributed version control systems. I used to use Darcs for most of my projects; these days I use Git, which has mostly caught up to Darcs in terms of user interface and is both more flexible and more widely used.
Common commands
darcs init
git init
darcs add X
git add X
(but git recurses by default)darcs revert X
git checkout -- X
darcs wh
git diff HEAD
darcs wh -s
git status
darcs rec X
-
git commit -p X
Similarly, there's
git add -p
, if you want to stage changes first.git diff --cached
shows what you've got staged.git commit -a
automatically adds modified/deleted files. darcs changes
git log
darcs changes --last 10
git log -10
darcs unrecord
-
-
To remove a bad last commit,
git reset --soft HEAD^
, thengit commit -c ORIG_HEAD
(the-c ...
starts with the old commit message). -
To add a change you forgot, stage it, then
git commit --amend
, which merges the current index into the last commit.
-
darcs push
-
git push [origin]
then
git reset --hard HEAD
on master to update working copy — but that will discard local changes! Seegit-push.txt
in the Git distribution for how to do this automatically with a hook, if safe.
Converting a Darcs repo to Git
I've written a more detailed article on this.
Thoughts on Darcs vs. Git
-
Git's underlying model seemed more complicated than Darcs' when I first started using it — probably because I started by reading the man pages — but it's actually pretty simple. I still slightly prefer tracking patches (Darcs-style) to tracking revisions (Git-style), but you can do the same stuff in the two systems.
-
I think it's a pity that
git push
andgit pull
aren't symmetrical. (Fetch/push are closer.) -
I find git's heuristic copy/rename detection a bit magical for my tastes. It generally works OK, but sometimes I'd like to be able to say "this new file really is based on this old one, even though I had to change a lot to make it work in its new location", for the sake of being able to follow changes in the history.
-
git rebase -i
is absolutely git's killer feature, since it lets you produce nice clean series of patches. -
Interactive modes for more things in git would be nice — it's pervasive in Darcs (for push, pull, revert, etc. as well as record).