Compare commits

..

No commits in common. "master" and "v1.3.1" have entirely different histories.

1 changed files with 54 additions and 248 deletions

View File

@ -13,24 +13,20 @@
% содержание и нумерация
\setcounter{tocdepth}{4} % table of contents depth
\setcounter{secnumdepth}{4} % numbering depth
% Fix PDF's cross-reference jumps
\restylefloat{table}
\restylefloat{figure}
\end_preamble
\use_default_options true
\begin_modules
braille
customHeadersFooters
enumitem
fixltx2e
fix-cm
braille
initials
figs-within-sections
tabs-within-sections
eqs-within-sections
endnotes
foottoend
logicalmkup
hanging
\end_modules
\maintain_unincluded_children false
\language russian
@ -52,21 +48,20 @@ hanging
\output_sync 0
\bibtex_command default
\index_command default
\float_placement H
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_title "Git-tutorial"
\pdf_author "Kolan Sh, InSys Ltd, Moscow"
\pdf_subject "Git"
\pdf_keywords "git,tutorial"
\pdf_keywords "tex,lyx,latex,texreport,texparser"
\pdf_bookmarks true
\pdf_bookmarksnumbered true
\pdf_bookmarksopen true
\pdf_bookmarksopenlevel 3
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_pdfborder false
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize default
@ -94,18 +89,18 @@ hanging
\shortcut idx
\color #008000
\end_index
\leftmargin 1.5cm
\leftmargin 2cm
\topmargin 1.5cm
\rightmargin 1cm
\bottommargin 2cm
\secnumdepth 5
\tocdepth 5
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
@ -115,6 +110,26 @@ hanging
\begin_body
\begin_layout Title
Краткое введение в Git
\end_layout
\begin_layout Author
Working horsy
\begin_inset Newline newline
\end_inset
InSys Ltd, Moscow
\end_layout
\begin_layout Date
February 27, 2013
\end_layout
\begin_layout Date
Версия 1.3.1
\end_layout
\begin_layout Standard
\begin_inset ERT
status open
@ -123,38 +138,9 @@ status open
\backslash
title{Краткое введение в Git}
thispagestyle{empty}
\end_layout
\begin_layout Plain Layout
\backslash
author{Колян Ш.
\backslash
\backslash
\backslash
normalsize Версия 1.3.5}
\end_layout
\begin_layout Plain Layout
\backslash
maketitle
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents
\end_inset
@ -167,6 +153,23 @@ LatexCommand tableofcontents
\end_inset
\end_layout
\begin_layout Standard
\lang english
\begin_inset CommandInset toc
LatexCommand tableofcontents
\end_inset
\lang russian
\begin_inset Newpage newpage
\end_inset
\end_layout
\begin_layout Section
@ -2146,56 +2149,6 @@ git rebase --continue # продолжить перепостроение ист
коммита
\end_layout
\begin_layout Subsubsection
Удаление тега в репозитории на сервере
\end_layout
\begin_layout Standard
Следующая команда удалит тег v0.1.2 на сервере:
\end_layout
\begin_layout LyX-Code
git push origin :refs/tags/v0.1.2
\end_layout
\begin_layout Standard
Следует не забыть также удалить тег локально:
\end_layout
\begin_layout LyX-Code
git tag -d v0.1.2
\end_layout
\begin_layout Standard
Иначе - при следующей отправки изменений он также попадёт на сервер.
\end_layout
\begin_layout Subsubsection
Обновление указателя головы ветки на сервере без локальных изменений
\end_layout
\begin_layout Standard
Следующая команда обновит указатель головы на сервере:
\end_layout
\begin_layout LyX-Code
git update-ref refs/heads/master 573f69d
\end_layout
\begin_layout Standard
Теперь голова ветки
\begin_inset Quotes eld
\end_inset
master
\begin_inset Quotes erd
\end_inset
в репозитории на сервере будет указывать на коммит с хешем 573f69d.
Это бывает полезно, когда хочется поработать над частью локальных коммитов,
отправляя невсе их сразу на сервер, а частями.
\end_layout
\begin_layout Subsubsection
Синхронизация веток
\end_layout
@ -2747,7 +2700,7 @@ git diff-tree -p mylib_remote/master # сравнить с удалённой в
\end_layout
\begin_layout LyX-Code
git clean -fd # удалить неотслеживаемые файлы в репозитории
git clean # удалить неотслеживаемые файлы в репозитории
\end_layout
\begin_layout LyX-Code
@ -2755,82 +2708,8 @@ git prune # удалить все недостижимые объекты/ком
\end_layout
\begin_layout LyX-Code
git prune-packed # удалить также уже упакованные недостижимые объекты
\end_layout
\begin_layout LyX-Code
git gc --aggressive --prune=all # удалить все бесполезные объекты и оптимизирова
ть локальный репозиторий
\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=all
может быть использована для периодической чистки shallow-репозитория от
старой истории.
git gc --aggressive --prune # удалить все бесполезные объекты и оптимизировать
локальный репозиторий
\end_layout
\begin_layout Subsection
@ -2950,79 +2829,6 @@ git fsck --lost-found # с большой долей вероятности из
ревизии
\end_layout
\begin_layout Standard
\begin_inset space ~
\end_inset
\end_layout
\begin_layout Standard
Бывает также, что пользователь отключил
\begin_inset Quotes eld
\end_inset
reflog
\begin_inset Quotes erd
\end_inset
в настройках Git по ошибке или по неопределённым личным обстоятельствам.
В таких случаях может буквально спасти опция
\begin_inset Quotes eld
\end_inset
--dangling
\begin_inset Quotes erd
\end_inset
у
\begin_inset Quotes eld
\end_inset
git fsck
\begin_inset Quotes erd
\end_inset
:
\end_layout
\begin_layout LyX-Code
$ git fsck --dangling
\end_layout
\begin_layout LyX-Code
Checking object directories: 100% (256/256), done.
\end_layout
\begin_layout LyX-Code
Checking objects: 100% (84/84), done.
\end_layout
\begin_layout LyX-Code
dangling blob cd0120b458d5ab07efed5bb690b0eec8c1801b55
\end_layout
\begin_layout Standard
\begin_inset space ~
\end_inset
\end_layout
\begin_layout Standard
В конце выхлопа команды указаны хеши некогда существующих объектов, которые
никогда не использовались (не добавлялись в репозиторий).
Для восстановления требуемых объектов используется та же команда Git
\begin_inset Quotes eld
\end_inset
checkout
\begin_inset Quotes erd
\end_inset
.
\end_layout
\begin_layout Section
Удачная модель ветвления
\end_layout