wiki:GitForDarcsUsers

Version 3 (modified by nominolo, 6 years ago) (diff)

add even more notes

Git for Darcs Users

Just like Darcs, every Git command comes with a --help option. For example git add --help. You can also check out the official Git documentation.

Also see "General Notes" below for features present in Git but not in Darcs.

General Settings

Just like Darcs, Git has global and per-repository configuration options. To globally set your committer name and email use

git config --global user.name "Haskell Curry"
git config --global user.email haskell@example.com

Commands

darcs init

git init

darcs get

git clone <repo-url> [<local-name>]

darcs add

git add <dir-or-file>

darcs record

Git supports interactive recording very similar to darcs.

git add -p

or

git add -i

The main difference is that Git does not automatically commit the changes. You have to do that manually using

git commit [-m "commit message"]

If you do not supply a commit message, it will open your default editor. If you want to abort the commit, use an empty commit message.

To see what will be committed, use

git diff --cached

Tip: If you want to see the diff when you edit the commit message, use

git commit -v

darcs record -a

git commit -a

This will add and commit all (not ignored) files.

darcs changes

git log

darcs changes --last <N>

git log -n <N>

darcs changes --summary

git log --stat

other

git log -p

Shows the patch for each commit.

See git log --help for a lot of extra options, to refine the output.

darcs whatsnew

git status

darcs diff

git diff

TODO describe diff commands for index

darcs revert

git reset --hard

Note: git reset only resets the staged files, i.e., the things added with git add.

darcs unrecord

...

darcs annotate

git blame

General Notes

The Index

Local Branches

TODO

git branch
git branch <name>
git branch -b <name>
git checkout
git branch -d <name>
git branch -D <name>
git stash
git show-branch
git pull
git fetch
git merge

Suggested Workflow

TODO

  • feature branches
  • git rerere