当前位置: 首页 > 工具软件 > hg-diff > 使用案例 >

Hg 常用命令

赫连明诚
2023-12-01

Mercurial Commands

https://gist.github.com/cortesben/016cd401faae5a8dae59

CommandsDescription
hg pullget latest changes like git pull use flags like -u IDK why yet
hg addonly for new files
hg commitadd changes to commit with -m for message just like git
hg addremoveadds new files and removes file not in your file system
hg incomingsee changes commited by others
hg outgoingsee local commits
hg commit --amendsame as git commit --amend
hg record filenameshows history of changes to file uses extension
hg mergelike a git mergehttp://hgbook.red-bean.com/read/a-tour-of-mercurial-merging-work.html
hg log -r tiptip changelog
hg log -l 5last 5 changelog statuses
hg status -mshow modified files only
hg status -rshow removed files only
hg status -ashow added files only
hg strip “0000”remove commit from history and delete changes before push, if pushed you are fucked
hg log -u email@accout.comsee all account commits | type -v for a verbose version
hg diff -r 0000:0000 /dir/location/pathDiff versions of same file from different CHANGESET
hg diff | less; hg commitshow changes committed
hg outSee what is not pushed to remote branch
hg update 0000CHANGESET = 0000 or branchname
hg checkout branchworks like a git checkout branch
hg recordshows record of pending changes
hg update -Cresets your head and removes commits not pushed like git reset --hard
hg backout 0000CHANGESET = 0000 like a git revert tag/hash
hg blame or hg annotatesame as a git blame
hg bisectlets you test inbetween commits to find bugs http://mercurial.selenic.com/wiki/BisectExtension
hg shelvelike a git stash(Requires the ShelveExtension or the AtticExtension.)
hg graft --edit 0000lets you pick what changes to push to default or commit CHANGESET = 0000 git cherry-pick <commit>http://selenic.com/hg/help/graft
hg graft --edit 0000::0005add a series of commits from 0000 to 0005 as a batch
hg headsshows changes in child and parent branches
hg identify --numcurrent changeset
hg branch featurego to default branch and use this command to create a new branch namded “feature” based off of it
hg commit --close-branch -m ‘closing this branch’Inside branch you want to close commit this and push so branch disapears and keeps your coworkers happy
noteHg .hgignore, syntax: glob is the same behaviour as git’s .gitignore.

Branching

http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

 类似资料: