User Tools

Site Tools


git:move-files-to-another-repo-keep-history

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
git:move-files-to-another-repo-keep-history [2023/11/24 12:36] odeftagit:move-files-to-another-repo-keep-history [2023/11/28 23:30] (current) odefta
Line 12: Line 12:
 It should de downloaded first from https://github.com/newren/git-filter-repo It should de downloaded first from https://github.com/newren/git-filter-repo
  
 +<code>
 python3 git-filter-repo --force --path src/main/resources/folder1 --path src/main/resources/folder2 python3 git-filter-repo --force --path src/main/resources/folder1 --path src/main/resources/folder2
 +</code>
  
 3) In destination repo (B) we should add A as a remote source repo 3) In destination repo (B) we should add A as a remote source repo
  
 +<code>
 git remote add source C:\repoA git remote add source C:\repoA
 +</code>
  
 source - remote repo name source - remote repo name
Line 23: Line 27:
 4) From B import data from A: 4) From B import data from A:
  
 +<code>
 git fetch source git fetch source
 +</code>
  
 5) From B, merge A branch: 5) From B, merge A branch:
  
 +<code>
 git merge source/branchOnRepoA --allow-unrelated-histories git merge source/branchOnRepoA --allow-unrelated-histories
 +</code>
  
 6) From B, remove A: 6) From B, remove A:
  
 +<code>
 git remote remove source git remote remove source
 +</code>
  
 7) From B, push changes: 7) From B, push changes:
 +
 +<code>
 git push "origin" main:main git push "origin" main:main
 +</code>
  
 <note>If git repo is hosted in gitlab and you receive the error: "You can only push commits if the committer email is one of your own verified emails.", check repo settings in gitlab and uncheck the following checkbox: {{:git:pasted:20231124-123408.png}}</note> <note>If git repo is hosted in gitlab and you receive the error: "You can only push commits if the committer email is one of your own verified emails.", check repo settings in gitlab and uncheck the following checkbox: {{:git:pasted:20231124-123408.png}}</note>
git/move-files-to-another-repo-keep-history.1700822205.txt.gz · Last modified: 2023/11/24 12:36 by odefta