0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SVNでフォルダ構成を変更する方法

Posted at

概要

SVNで管理しているプロジェクトでは、ファイルが増えてくると整理したくなる場面がよくありますよね。
フォルダ構成を見直したり、新しいディレクトリへファイルを移動したい場合でも、ローカルの mv コマンドで移動してしまうと履歴が切れてしまい、SVNが変更として認識できません。

そのため、正しい手順で作業することが大切です。ここでは、履歴を保ったまま安全にフォルダ構成を変更する基本の流れをまとめてみました。

基本的な手順

1. 新しいフォルダを作成する

svn mkdir new_folder_name

まずは追加したい場所に新しいフォルダを作成します。
svn mkdir を使うことで、フォルダがそのままSVN管理下に入ります。

2. ファイルを移動する

svn move old_path/file.txt new_folder_name/file.txt

既存ファイルを移動するときは、必ず svn move を使いましょう。
ローカルの mv だけで移動してしまうと、SVNが移動として認識できず、履歴が切れてしまいます。

3. 状態を確認してコミットする

svn status
svn commit -m "フォルダ構成を変更"

移動内容に問題がないか確認し、問題なければコミットします。

重要なポイント

■ 履歴を保ったまま移動できる

svn move を使うことで、元ファイルの履歴を引き継いだまま別フォルダへ移動できます。
これで後から変更履歴を追えるので安心ですね!

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?