5

develop/user1/issue1リモートリポジトリのようにgitブランチを作成したいのですが、どうすれば作成できますか?

- master => /origin/master
- develop => /origin/develop
    - user1 => /origin/develop/user1
         - issue1 => /origin/develop/user1/issue1
         - issue2 => /origin/develop/user1/issue2
         - issue3 => /origin/develop/user1/issue3
    - user2 => /origin/develop/user2
         - issue4 => /origin/develop/user1/issue4
         - issue5 => /origin/develop/user1/issue5
4

1 に答える 1

19

基本的に、あなたが提案しているような構造を作成することはできません。

なんで?

スラッシュを含むブランチがある場合、.git/refs/heads の下にディレクトリ階層として保存されるためです。

確認方法

空のディレクトリにブランチがないとします。

したがって、次を使用してダミーのリポジトリを作成します

touch testfile && git init && git add . && git commit -m "initializing"`.

次に、git branch コマンドを実行して、提案どおりにいくつかのブランチを作成します。

git branch origin/master
git branch origin/develop/user1
git branch origin/develop/user2/issue4

次に、.git/refs/heads ディレクトリに cd して、次のコマンドcd .git/refs/headsを実行します。ls -la

git によって次のディレクトリ構造が作成されていることがわかります。

master (file)
origin (directory)
|_master (file)
|_develop (directory)
   |_user1 (file)
   |_user2(directory)
     |_issue4 (file)

を使用してブランチを作成しようとするとgit branch origin/develop/user1/issue1、コマンドがディレクトリである必要があるときに user1 という名前のファイルが既に存在するため、エラーがスローされます。

于 2013-09-12T11:55:05.290 に答える