Git Magic. Глава 4. Чудеса ветвления

Ben Lynn, “Git Magic. Chapter 4. Branch Wizardry”, public translation into Russian from English More about this translation.

See also 13 similar translations

Translate into another language.

Participants

mifistor1223 points
Natamile702 points
vixus278 points
And others...
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next
1 2 3 4 5

Git Magic. Chapter 4. Branch Wizardry

Git Magic. Глава 4. Чудеса ветвления

History of edits (Latest: Natamile 1 year, 2 months ago) §

— Уважаемые коллеги, я создал открытый репозиторий gitmagic-ru, где хранится вся работа: http://github.com/mifistor/gitmagic-ru Вы можете скачать и посмотреть черновой вариант: http://files.getdropbox.com/u/281916/... Если в книге Вам не понравился или был непонятен перевод, пожалуйста свяжитесь со мной: mifistor@gmail.com mifistor

== Branch Wizardry ==

== Чудеса ветвления ==

History of edits (Latest: Natamile 1 year, 2 months ago) §

Instant branching and merging are the most lethal of Git's killer features.

Возможности мгновенного разветвления и слияния - самые уникальные особенности Git.

History of edits (Latest: Natamile 1 year, 2 months ago) §

*Problem*: External factors inevitably necessitate context switching. A severe bug manifests in the released version without warning. The deadline for a certain feature is moved closer. A developer whose help you need for a key section of the project is about to leave. In all cases, you must abruptly drop what you are doing and focus on a completely different task.

*Задача*: какие-то причины требуют переключения процессов. В новой версии внезапно возникает серьезная ошибка. Срок завершения работы над определенным свойством близится к концу. Разработчик, помощь которого очень нужна Вам в работе над ключевым разделом, собирается в отпуск. Итак, Вам нужно срочно бросить все, над чем Вы трудитесь в настоящий момент, и переключиться на совершенно другие дела.

History of edits (Latest: Natamile 1 year, 2 months ago) §

Interrupting your train of thought can be detrimental to your productivity, and the more cumbersome it is to switch contexts, the greater the loss. With centralized version control we must download a fresh working copy from the central server. Distributed systems fare better, as we can clone the desired version locally.

Переключение внимания с одного на другое может серьезно снизить эффективность работы, и чем сложнее переход между процессами, тем больше будет потеря. При централизованном управлении версиями необходимо скачивать вновь разработанную рабочую копию с центрального сервера. Распределенная система предоставляет лучшие возможности, так как позволяет клонировать нужную версию в локальное рабочее место.

History of edits (Latest: Natamile 1 year, 2 months ago) §

But cloning still entails copying the whole working directory as well as the entire history up to the given point. Even though Git reduces the cost of this with file sharing and hard links, the project files themselves must be recreated in their entirety in the new working directory.

Однако клонирование все же предполагает копирование всей рабочей директории, а, значит, всей истории изменений до настоящего момента. Даже при том, что Git позволяет сэкономить средства за счет возможности совместного использования файлов и жестких ссылок, все файлы проекта придется полностью воссоздать в новой рабочей директории.

History of edits (Latest: Natamile 1 year, 2 months ago) §

*Solution*: Git has a better tool for these situations that is much faster and more space-efficient than cloning: *git branch*.

*Решение*: у Git есть более удобный инструмент для этих целей, который, в отличие от клонирования, сэкономит и время, и дисковое пространство - это *git branch*.

History of edits (Latest: Natamile 1 year, 2 months ago) §

With this magic word, the files in your directory suddenly shapeshift from one version to another. This transformation can do more than merely go back or forward in history. Your files can morph from the last release to the experimental version to the current development version to your friend's version and so on.

С этой волшебной командой файлы в вашей директории мгновенно изменяются с одной версии на другую. Это изменение позволяет сделать намного больше, чем просто вернуться назад или продвинуться вперед в истории. Ваши файлы могут изменится с последней версии на экспериментальную, с экспериментальной - на опытную, с опытной - на версию вашего друга и так далее.

History of edits (Latest: Natamile 1 year, 2 months ago) §

=== The Boss Key ===

=== "Кнопка босса" ===

History of edits (Latest: Natamile 1 year, 2 months ago) §

— "кнопка босса" - весело звучит :) soshial

второй комментарий. очень извиняюсь - просто тестирую этот сервис :) soshial

— Можете и дальше тестировать, даже с пользой. Присоединяйтесь к переводу :) mifistor

Ever play one of those games where at the push of a button ("the boss key"), the screen would instantly display a spreadsheet or something? So if the boss walked in the office while you were playing the game you could quickly hide it away?

Наверняка, вы играли в одну из тех игр, где при нажатии определеной клавиши ("кнопка босса"), игра быстро сворачивается и на экране отображается рабочая таблица или что-нибудь другое? То есть, если в офис зашел начальник, а вы играете в игру, вы должны уметь быстро ее скрыть.

History of edits (Latest: Natamile 1 year, 2 months ago) §

In some directory:

В какой-нибудь директории:

History of edits (Latest: mifistor 1 year, 2 months ago) §

$ echo "I'm smarter than my boss" > myfile.txt

$ echo "Я хитрее моего босса" > myfile.txt

History of edits (Latest: Natamile 1 year, 2 months ago) §

$ git init

$ git init

History of edits (Latest: mifistor 1 year, 2 months ago) §

$ git add .

$ git add .

History of edits (Latest: mifistor 1 year, 2 months ago) §

$ git commit -m "Initial commit"

$ git commit -m "Начальный коммит"

History of edits (Latest: mifistor 1 year, 2 months ago) §

We have created a Git repository that tracks one text file containing a certain message. Now type:

Мы создали Git-репозиторий который содержит один текстовый файл с определенным сообщением. Теперь выполните:

History of edits (Latest: Natamile 1 year, 2 months ago) §
Pages: ← previous Ctrl next
1 2 3 4 5

License: GNU General Public License version 3