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



沒有留言:

張貼留言

202501 Debian USB LAN Card Bridge

 202501 Debian USB LAN Card Bridge ChatGPT Question I have a machine running debian 12 with a LAN port using a cable to connect to my office...