2017-09-07 15 views
0

git bundleコマンドを使用してローカルgitリポジトリをエクスポートしようとしました。しかし、すべてが輸出されているわけではないようです。ローカルのgitリポジトリを正しくエクスポートするにはどうしたらいいですか?バンドルをアンバンドルするべきではないと私は読んだが、代わりにそれをクローンする必要がある。git bundleを使用してローカルgitリポジトリをエクスポートできません

PS C:\dev\repo\local-repo> git status 
On branch dev 
Your branch is up-to-date with 'origin/dev'. 
Changes not staged for commit: 
(use "git add <file>..." to update what will be committed) 
(use "git checkout -- <file>..." to discard changes in working directory) 

     modified: application/config/config.php 
     modified: application/controllers/Account.php 
     modified: application/controllers/Hook.php 
     modified: application/controllers/Test.php 
     modified: application/models/User.php 
     modified: application/views/backend/account/main.php 
     modified: application/views/backend/account/nav.php 
     modified: application/views/backend/referrals_table.php 

Untracked files: 
(use "git add <file>..." to include in what will be committed) 

     application/models/Permission.php 
     application/models/Referral.php 
     application/models/Resellercredit.php 
     application/models/Resellerpackage.php 
     application/models/Usergroup.php 
     application/views/backend/account/reseller_center.php 

no changes added to commit (use "git add" and/or "git commit -a") 

PS C:\dev\repo\local-repo> git branch 
* dev 
master 

PS C:\dev\repo\local-repo> git stash list 
[email protected]{0}: On dev: linux migration stash 

PS C:\dev\repo\local-repo> git bundle create ..\migrate.git --all 
Counting objects: 4249, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (1546/1546), done. 
Writing objects: 100% (4249/4249), 10.17 MiB | 0 bytes/s, done. 
Total 4249 (delta 2709), reused 4186 (delta 2680) 



PS C:\dev\repo> git clone migrate.git remote-repo 
Cloning into 'remote-repo'... 
Receiving objects: 100% (4249/4249), 10.17 MiB | 0 bytes/s, done. 
Resolving deltas: 100% (2709/2709), done. 

PS C:\dev\repo> cd .\remote-repo\ 
PS C:\dev\repo\remote-repo> git branch 
* dev 
PS C:\dev\repo\remote-repo> git stash 
No local changes to save 
PS C:\dev\repo\remote-repo> git stash list 
PS C:\dev\repo\remote-repo> 

私のコミットされていないファイルが含まれているので、本当に隠しが必要です。ローカルリポジトリ全体をエクスポートするための他の選択肢(ステージングのない変更を含む)はありますか?私はフォルダ全体を別のマシン(まったく別のOS)にコピーしようとしましたが、gitステータスを実行すると、 "unstaged changes"の下にさらに多くのファイルが表示されます。

答えて

0

バンドルを作成するときに、参照refs/stashを追加します。

私のテストでは、--allは機能しません。だから、refs/stashを含む、私が必要とするすべての参考文献をリストアップしなければならない。

バンドルからクローンを作成し、ブランチをチェックアウトしたら(dev)、git fetch ../migrate.git refs/stash;git stash apply FETCH_HEADを実行して、変更を取得することができます。後で適用する場合は、git stashを実行して隠しコードを再作成することができます。

複数のstashエントリがある場合(たとえば、[email protected]{0}および[email protected]{1}git stash list)、それぞれのstashエントリにタグを付けることができます。すべてをバンドルに追加します。それらを新しいクローンに適用し、stashエントリを再作成します。

git tag stash0 [email protected]{0} 
git tag stash1 [email protected]{1} 
git bundle create ../migrate.git stash0 stash1 dev <other_refs> 
cd .. 
git clone migrate.git -- sample 
cd sample 
git checkout dev 
git stash apply stash0 
git stash 
git stash apply stash1 
git stash 
git tag -d stash0 stash1 
関連する問題