how to use git filter-repo to merge another git repo into current repo with specific…
- User
how to use git filter-repo to merge another git repo into current repo with specific directory
- Assistant
To merge another git repo into your current repo in a specific directory using git filter-repo, follow these steps:
-
Clone the repo you want to merge into your current repo:
git clone <url-to-repo> -
Navigate to the directory you want to merge the repo into in your current repo and create an empty subdirectory:
cd <path-to-directory> mkdir <subdirectory-name> -
Move the contents of the cloned repo into the subdirectory you just created:
mv <path-to-cloned-repo>/* <subdirectory-name> -
Add the subdirectory to the current repo and commit the changes:
git add <subdirectory-name> git commit -m "Merge another repo into current repo" -
Install the git filter-repo tool. Follow the instructions on the installation guide: https://github.com/newren/git-filter-repo/blob/main/INSTALL.md
-
- User
how to keep the commites
- Assistant
If you want to keep the commits from the cloned repo while merging it into the current repo, you can follow these steps:
- Clone the repo you want to merge into your current repo:
git clone <url-to-repo> - Navigate to the directory you want to merge the repo into in your current repo and create an empty subdirectory:
cd <path-to-directory> mkdir <subdirectory-name> - Move the contents of the cloned repo into the subdirectory you just created:
mv <path-to-cloned-repo>/* <subdirectory-name> - Add the subdirectory to the current repo and commit the changes:
git add <subdirectory-name> git commit -m "Merge another repo into current repo" - Fetch the remote branch you want to merge with:
git fetch <remote> <branch> - Merge the fetched branch into the current branch:
git merge --allow-unrelated-histories <remote>/<branch>
- Clone the repo you want to merge into your current repo: