diff --git a/git-tutorial.lyx b/git-tutorial.lyx index 142eeda..e23f5e6 100644 --- a/git-tutorial.lyx +++ b/git-tutorial.lyx @@ -2747,18 +2747,92 @@ git diff-tree -p mylib_remote/master # сравнить с удалённой в \end_layout \begin_layout LyX-Code -git clean # удалить неотслеживаемые файлы в репозитории +git clean -fd # удалить неотслеживаемые файлы в репозитории \end_layout \begin_layout LyX-Code git prune # удалить все недостижимые объекты/коммиты из базы данных \end_layout +\begin_layout LyX-Code +git prune-packed # удалить также уже упакованные недостижимые объекты +\end_layout + \begin_layout LyX-Code git gc --aggressive --prune # удалить все бесполезные объекты и оптимизировать локальный репозиторий \end_layout +\begin_layout Subsection +shallow-репозиторий +\end_layout + +\begin_layout Standard +Это такой репозиторий, который хранит лишь часть истории, что позволяет + сэкономить место на диске и входящий трафик при его создании, но запрещает + клонирование и другие операции с ним. +\end_layout + +\begin_layout Standard +Для создания shallow-репозитория можно выполнить клонирование обычного с + опцией --depth, например: +\end_layout + +\begin_layout LyX-Code +git clone --depth=1 git://github.com/gentoo-mirror/gentoo.git /var/portage/portage +\end_layout + +\begin_layout Standard +Для создания shallow-репозитория +\begin_inset Quotes eld +\end_inset + +на месте +\begin_inset Quotes erd +\end_inset + + ( +\begin_inset Quotes eld +\end_inset + +inplace +\begin_inset Quotes erd +\end_inset + +) без клонирования и передачи данных по сети подходит следующий вариант + (взято со +\begin_inset CommandInset href +LatexCommand href +name "stackoverflow" +target "http://stackoverflow.com/a/7937916/5218714" + +\end_inset + +): +\end_layout + +\begin_layout LyX-Code +git show-ref -s HEAD > .git/shallow +\end_layout + +\begin_layout LyX-Code +git reflog expire --expire=0 +\end_layout + +\begin_layout LyX-Code +git prune +\end_layout + +\begin_layout LyX-Code +git prune-packed +\end_layout + +\begin_layout Standard +Последняя последовательность команд совместно с git gc --aggressive --prune + может быть использована для периодической чистки shallow-репозитория от + старой истории. +\end_layout + \begin_layout Subsection Создание архива \end_layout