Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
develop:git [2024/03/30 03:09] admin [Общее] |
develop:git [2024/09/06 10:50] (текущий) admin |
||
---|---|---|---|
Строка 345: | Строка 345: | ||
+ | < | ||
+ | < | ||
+ | Точнее включение одного репозитория в другой, | ||
+ | |||
+ | <code bash> | ||
+ | # Клонируем тот репозиторий, | ||
+ | git clone https:// | ||
+ | cd first-repo | ||
+ | git remote rm origin # На всякий случай отвязываем репозиторий | ||
+ | |||
+ | # Подготавливаем репозиторий: | ||
+ | mkdir first_repo | ||
+ | git mv $(ls -A | grep -v first_repo | grep -v .git) first_repo/ | ||
+ | git commit -m " | ||
+ | |||
+ | # Клонируем рядом целевой репозиторий | ||
+ | cd .. | ||
+ | git clone https:// | ||
+ | cd main_repo/ | ||
+ | |||
+ | # Подключаем к нему подготовленный первый репозиторий и вытаскиваем его master в отдельную ветку first-repo | ||
+ | git remote add first-repo ../ | ||
+ | git fetch first-repo | ||
+ | git branch first-repo remotes/ | ||
+ | |||
+ | # Мержим ветку в локальный master | ||
+ | git merge first-repo --allow-unrelated-histories | ||
+ | git remote rm first-repo | ||
+ | |||
+ | # Проверяем и пушим | ||
+ | git log | ||
+ | git push | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | <code bash> | ||
+ | git remote -v | ||
+ | # View existing remotes | ||
+ | # origin | ||
+ | # origin | ||
+ | |||
+ | git remote set-url origin https:// | ||
+ | # Change the ' | ||
+ | |||
+ | git remote -v | ||
+ | # Verify new remote URL | ||
+ | # origin | ||
+ | # origin | ||
+ | </ | ||
+ | </ | ||
===== ===== | ===== ===== |