2017-09-07 4 views
0

git bundle 명령을 사용하여 로컬 git 리포지토리를 내보내려고했습니다. 그러나 모든 것이 수출되는 것은 아닙니다. 로컬 git 저장소를 올바르게 내보내려면 어떻게해야합니까? 번들을 번들 해제해서는 안되지만 대신 복제해야한다고 읽었습니다.git 번들을 사용하여 로컬 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> 

내 커밋되지 않은 파일이 포함되어 있기 때문에 정말 숨겨져 있어야합니다. 내 전체 로컬 저장소를 내보내는 다른 방법이 있습니까 (unstaged 변경 포함)? 전체 컴퓨터의 폴더를 다른 컴퓨터에 복사하려고 시도했으나 다른 운영체제를 사용하고 있습니다.하지만 git status를 실행하면 더 많은 파일이 "unstaged changes"아래에 표시됩니다.

답변

0

번들을 생성 할 때 참조 refs/stash을 추가하십시오.

git bundle create ..\migrate.git refs/stash dev <other_refs> 

내 테스트에서는 --all이 작동하지 않습니다. 그래서 나는 refs/stash을 포함하여 필요한 모든 심판을 나열해야합니다.

번들에서 복제본을 만들고 브랜치 (dev)를 체크 아웃하면 git fetch ../migrate.git refs/stash;git stash apply FETCH_HEAD을 실행하여 숨겨진 변경 사항을 검색 할 수 있습니다. 나중에 적용하려면 git stash을 실행하여 숨김을 다시 만들 수 있습니다.

git stash list로 예를 [email protected]{0}[email protected]{1} 더 이상 숨김 항목이있는 경우, 각 숨김 항목에 대한 태그를 만들 수 있습니다. 그리고 그 모두를 번들에 추가하십시오. 새 복제본에 적용하고 숨겨진 항목을 다시 만듭니다.

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