Last active
January 14, 2018 20:48
-
-
Save razorcd/4e28febe4897cf1bd5ff9b30d31c3913 to your computer and use it in GitHub Desktop.
Git Subtree merging while keeping the commits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add remote repo from another filepath: | |
git remote add -f springBootSippetsFullRepo ../1/spring-boot-snippets-full-folder | |
# merge to current master (will not messup original files) | |
git merge -s ours springBootSippetsFullRepo/master | |
# move new repo in a subfolder: | |
git read-tree --prefix=springBootSnippets -u springBootSippetsFull/master | |
# comit new folder: | |
git commit -v -m "merges springBootSnippets as subfolder" | |
# Notice that the new folder has no .git folder anymore. | |
# Remember that subtree merge will not include any files that are not in the commits. | |
# So files that are in .gitignore will not be copied. You might want to copy these manually. (E.g. IDE config files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment