LoginSignup
15
21

More than 5 years have passed since last update.

git svn dcommitを対話的に行う

Last updated at Posted at 2013-07-22

git-svnを導入した当初は、git svn dcommitが怖くてビビったりする事がよくありました(私の場合)。
そこで実際にどのような事が行われるか、シミュレートする方法に関してメモしておきます。

--dry-runを利用したシミュレート

git svn dcommit --dry-runを実行する事で、実際に実行されるコマンドの内容をシミュレートする事が出来ます。
実行した結果もdiffとして確認する事が可能です。

root$ git svn dcommit --dry-run
Committing to file:///tmp/work/svn-repo ...
diff-tree e0dfd8fc7b5e6b563a7fd303fc734f9b38a1081f~1 e0dfd8fc7b5e6b563a7fd303fc734f9b38a1081f

dcommitによって複数回svnに対してコミットが行われる場合は、diffツリー自体も複数のhashが表示されるので安心です。

root$ git svn dcommit --dry-run
Committing to file:///tmp/work/svn-repo ...
diff-tree e0dfd8fc7b5e6b563a7fd303fc734f9b38a1081f~1 e0dfd8fc7b5e6b563a7fd303fc734f9b38a1081f
diff-tree 9bd86d34a8521c120da9e32296b4eb0fa5b99c0b~1 9bd86d34a8521c120da9e32296b4eb0fa5b99c0b
root$ git svn dcommit --dry-run
Committing to file:///tmp/work/svn-repo ...
diff-tree e0dfd8fc7b5e6b563a7fd303fc734f9b38a1081f~1 e0dfd8fc7b5e6b563a7fd303fc734f9b38a1081f

--interactiveによる対話的実行

--dry--runによってコミットされる内容は確認できますが、コミットメッセージを確認することが出来ません。コミットされるメッセージを確認したい場合はgit svn dcommit --interactiveとする事で、コミット処理を対話的に実行することが可能になります。
なお、--interactive自体は実際にSVNにコミットされますのでご注意下さい。

root$ git svn dcommit --interactive
Committing to file:///tmp/work/svn-repo ...
commit 0f2eb0e4e92102bd810df6c04dc7df4377228d69
Author: root <root@localhost.com>
Date:   Mon Jul 22 10:20:11 2013 +0900

    コミットメッセージ

Commit this patch to SVN? ([y]es (default)|[n]o|[q]uit|[a]ll): y
        M       README.txt
Committed r4
        M       README.txt
r4 = a1da0584f58583456ba93c6f40b09a8a9b8dd603 (refs/remotes/git-svn)
No changes between 0f2eb0e4e92102bd810df6c04dc7df4377228d69 and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn

docmmitによって複数回svnにコミットが行われる場合は、上記の対話処理がコミットの分だけ表示されます。

root$ git svn dcommit --interactive
Committing to file:///tmp/work/svn-repo ...
commit 176f050c80caf383412953b6189dba064d33d98c
Author: root <root@localhost.com>
Date:   Mon Jul 22 10:17:45 2013 +0900

    1回目のコミットメッセージ

Commit this patch to SVN? ([y]es (default)|[n]o|[q]uit|[a]ll): y
commit d754728696117ff954d689b75c20139f1be80146
Author: root <root@localhost.com>
Date:   Mon Jul 22 10:18:02 2013 +0900

    2回目のコミットメッセージ

Commit this patch to SVN? ([y]es (default)|[n]o|[q]uit|[a]ll): y
        M       README.txt
Committed r2
        M       README.txt
r2 = f24ab0e968bad921f4c50a14d9c9fde7e16800ff (refs/remotes/git-svn)
        M       README.txt
Committed r3
        M       README.txt
r3 = ef6602e45749bd53d2b415e88282d48abbbb0127 (refs/remotes/git-svn)
No changes between d754728696117ff954d689b75c20139f1be80146 and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn

以上です。

15
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
21