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



沒有留言:

張貼留言

2007 to 2023 HP and Dell Servers Comparison

  HP Gen5 to Gen11  using ChatGPT HP ProLiant Gen Active Years CPU Socket Popular HP CPUs Cores Base Clock Max RAM Capacity Comparable Dell ...