Mam dwa repozytoria. Od czasu do czasu chcę scalić zawartość other
w main
. Jednak scalanie ignoruje usunięte pliki. Pozwól mi wyjaśnić to na przykładzie:Git ignoruje usunięty plik po scaleniu
mkdir -p test/main test/other
cd test/other/
git init
touch one two three
git add .
git commit -m "Add one, two and three."
cd ../main/
git init
touch four
git add .
git commit -m "Add four."
Dodaj other
do main
jako pilota.
git remote add other ../other/
git fetch other
Scal jego zawartość.
git merge --squash other/master
git commit -m "Merge other."
Dodaje pliki poprawnie. Teraz usuń plik w other
.
cd ../other/
git rm two
git commit -m "Remove two."
Scal zmiany w main
.
cd ../main/
git fetch other
git merge --squash other/master
po scaleniu git status
mówi:
# On branch master
nothing to commit (working directory clean)
spodziewałbym scalanie usunąć two
, gdyż został usunięty other
. Co ja robię źle?
To wyjaśnienie ma sens. Chciałem przeprowadzić scalenie w squasha, aby nie zanieczyszczać historii głównej z innymi. Ale wygląda na to, że nie ma innej drogi. Dzięki za pomoc! –
@GergoErdosi Jeśli chcesz * wyświetlić * historię "niezanieczyszczoną", spójrz na opcję 'first-parent' na' git log'. – Borealid
Dzięki za napiwek! –