linux:mercurial_git

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
linux:mercurial_git [2019/02/14 09:05] – 作成 ともやんlinux:mercurial_git [2021/03/31 05:18] (現在) ともやん
行 2: 行 2:
  
 ===== Mercurial の特徴 ===== ===== Mercurial の特徴 =====
 +[[python:mercurial|Mercurial - 分散型バージョン管理システム]](Linux)\\
 +[[linux:tortoisehg|TortoiseHg - Mercurial 分散型バージョン管理システム用ツール]](Linux)\\
 +[[windows:mercurial|TortoiseHg - Mercurial 分散型バージョン管理システム用ツール]](Windows)\\
 +[[mac:tortoisehg|TortoiseHg - Mercurial 分散型バージョン管理システム用ツール]](Mac)\\
   * Python で実装されたクロスプラットフォームの分散型バージョン管理システム   * Python で実装されたクロスプラットフォームの分散型バージョン管理システム
   * ライセンスは GPL v2   * ライセンスは GPL v2
行 12: 行 16:
  
 ===== Git の特徴 ===== ===== Git の特徴 =====
 +[[linux:git|Git - 分散型バージョン管理システム]]\\
   * 分散型バージョン管理システム   * 分散型バージョン管理システム
   * ライセンスは GPL v2   * ライセンスは GPL v2
行 17: 行 22:
   * 中心リポジトリにアクセスできない環境でも履歴の調査や変更の記録といったほとんどの作業を行うことができる   * 中心リポジトリにアクセスできない環境でも履歴の調査や変更の記録といったほとんどの作業を行うことができる
  
 +===== コマンド比較 =====
 +<html>
 +  <style>
 +    table {
 +      font-size: 10px;
 +    }
 +    table pre {
 +      font-size: 10px;
 +      padding: 0;
 +      margin: 0 0 2px 0;
 +      word-wrap: inherit;
 +    }
 +    .col0 { width: 120px; }
 +  </style>
 +</html>
 +^  Mercurial  ^  Git  ^  説明  ^  補足  ^
 +| <code>hg clone</code>  | <code>git clone</code>  | リポジトリをクローン  |   |
 +| <code>hg add <file></code>  | <code>git add <file></code>  | ファイルを登録  | Mercurial は新規登録されるファイル以外は add 不要\\ Git はコミットのたびに変更ファイルの add が必要  |
 +| <code>hg add</code>  | <code>git add .</code>  | すべてのファイルを登録  |   |
 +| <code>hg addremove</code>  |  -  | 次回コミットを実行する際に追加または削除されるファイルを登録  | 未登録のファイル(?)は hg add、削除されたファイル(!)は hg remove する  |
 +| <code>hg remove <file></code>  | <code>git rm <file></code>  | ファイルを削除  |
 +| <code>hg rename/move</code>  | <code>git mv</code>  | ファイル名を変更\\ copy + remove と同じ  |
 +| <code>hg diff</code>  | <code>git diff</code>(add前)\\ <code>git diff –cached</code>(add後)  | 差分確認  |   |
 +| <code>hg revert</code>  | <code>git checkout --force</code><code>git checkout .</code><code>git checkout -- *</code><code>git reset --hard origin/master</code>  | ファイルやディレクトリを以前の状態に復旧  |   |
 +| <code>hg status</code>  | <code>git status</code>  | ローカルのリポジトリで更新があったファイルの一覧を表示  |   |
 +| <code>hg update [-C]</code>  | <code>git merge origin/master</code>  | 作業ディレクトリをリポジトリの最新内容に更新  |   |
 +| <code>hg tags</code>  | <code>git tag</code>  | タグの一覧を表示  |   |
 +| <code>hg branch <branch name></code>  | <code>git checkout -b <branch name></code>  | ブランチの作成  |   |
 +| <code>hg update <branch name></code>  | <code>git checkout <branch name></code>  | ブランチの切替  |   |
 +| <code>hg commit --close-branch</code>  | <code>git branch --delete <branch name></code>  | ブランチの削除/閉鎖  | Mercurial は閉鎖という概念\\ Git はブランチの削除  |
 +| <code>hg update <branch name>
 +hg commit</code>  | <code>git reflog
 +git branch <branch name> HEAD@<番号></code>  | 削除/閉鎖 されたブランチの復旧  | Mercurial は非アクティブの branch を復活させる\\ Git はブランチをもどすイメージ  |
 +| <code>hg branches</code>  | <code>git branch</code>  | ローカルブランチを表示  |   |
 +|  -  | <code>git branch -a</code>  | リモートブランチを表示  | Mercurial は取り込みが必要  |
 +| <code>hg pull -update</code>  | <code>git branch <branch name> /origin/<branch name></code>  | リモートブランチをローカルへ取り込む  | Mercurial は全てのブランチをローカルに展開\\ Git は特定のブランチのみをローカルに展開  |
 +| <code>hg pull –update</code>  | <code>git pull</code><code>git fetch
 +git merge /origin/<branch name></code>  | 変更差分の取り込み  | Mercurial はブランチのローカル取り込みと作業ディレクトリのリポジトリ最新内容に更新を同時に行う  |
 +|   | <code>git pull --tags</code>  | リモートのタグを取得  |   |
 +| <code>hg merge</code>  | <code>git stash save -u
 +git merge origin/<branch_name>
 +git stash pop</code>  | ローカルリビジョンと指定リビジョンのマージ  | Mercurial はコンフリクトしたら手動修正\\ Git は git stash list で stash した list の確認、コンフリクトしたら手動修正  |
 +| <code>hg merge <branch name></code>  | <code>git merge origin/<branch name></code>  | ブランチ間のマージ  |   |
 +| <code>hg commit</code>  | <code>git commit -a</code>  | ローカルリポジトリにコミット  |   |
 +| <code>hg push</code>  | <code>git push</code>  | コミットした変更をリポジトリサーバに反映  |   |
 +|   | <code>git push --tags</code>  | ローカルのタグをリモートに push  |   |
 +| <code>hg annotate/blame <file></code>  | <code>git blame <file></code>  | チェンジセットを行ごとに表示  |   |
 +| <code>hg cat <file></code><code>hg cat -r <revision> -o <out file> <file></code>  | <code>git cat-file -p <revision>:<file></code>  | ファイルを出力  |   |
 +| <code>hg log</code>  | <code>git log</code>  | 全てのリポジトリまたはファイルの変更履歴を表示  |   |
 +| <code>hg help</code>  | <code>git help</code>  | ヘルプを表示  |   |
 +| <code>hg convert</code>  |  -  | 別 SCM のリポジトリから Mercurial リポジトリへの変換  | Mercurial は convert プラグインを有効化する必要がある  |
 +|  | <code>git clone --recursive <url></code>  | submodule をクローン  |  |
 +|  | <code>git clone
 +cd <directory>
 +git submodule update --init --recursive</code>  | submodule をクローンし忘れた場合  |  |
 +
 +===== 参考文献 =====
 +[[https://stackoverflow.com/questions/35837/what-is-the-difference-between-mercurial-and-git|version control - What is the Difference Between Mercurial and Git? - Stack Overflow]]\\
  
  • linux/mercurial_git.1550102747.txt.gz
  • 最終更新: 2019/05/18 02:23
  • (外部編集)