2022年3月16日 星期三

GIT How to move some files from a repository to another repository? Use git am and patch

 https://stackoverflow.com/questions/1365541/how-to-move-some-files-from-one-git-repo-to-another-not-a-clone-preserving-hi



cd repository
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch.txt
cd ../another_repository
git am --committer-date-is-author-date < ../repository/patch.txt


Use 
git am --reject --committer-date-is-author-date < ../repository/patch.txt


https://jyx.github.io/apply-patches-in-git.html

$ git am < my_new_feature.patch
$ git apply --reject --whitespace=fix my_new_feature.patch
$ git status
$ vim my_conflicting_file.c*
$ find . -name "*.rej" -exec rm -f {} \;
$ git add .
$ git am --resolved

My Repeat:
git status
rm .rej
git am --skip


git add .
git am --continue



沒有留言:

張貼留言

2023 Promox on Morefine N6000 16GB 512GB

2023 Promox on Morefine N6000 16GB 512GB Software Etcher 100MB (not but can be rufus-4.3.exe 1.4MB) Proxmox VE 7.4 ISO Installer (1st ISO re...