Version Control

hg update -C .
git reset –hard

Discard uncommitted changes

hg clone git+ssh://user@server/directory [“Target directory”]

Clone a git repository into a mercurial one, only working with hg-git extension

git add -u .

Add and remove files to prepare for commit. Same as “addremove” in mercurial

git checkout .

Revert to last commit, discard all changes since last commit.

git commit -a -m “<Checkin comment>”

Checkin all files, add and remove files

git add -A && git commit -m “Your Message”

Checkin all files including new and deleted files

Mercurial

If you have a problem with not trusted files, here is the solution:

  1. In the file /etc/mercurial/hgrc insert the trusted users
    [trusted]
    users = user,[, user2...]
  2. In the file ~/.hgrc add the user who owns the files to the trusted users
    [trusted]
    users = root

Mercurial

End trunc and merge with other trunk


$ hg commit --close-branch -m 'Ready for merge'
$ hg update default
$ hg merge mybranch
$ hg commit -m 'Integrated mybranch'

Git

Hard reset local and remote repository

Hard reset local repository

  • Find commit with git log .
  • Hard reset git reset –hard <commit hash from log>

Hard reset remote repository

  • git push -f <remote> <branch-name>