Читать книгу Английский для программистов. Как общаться в международных IT-командах - - Страница 10
Working with Version Control (Git) (Работа с системой контроля версий, Git)
ОглавлениеАлексей работает над проектом, и его коллега, Оля, обучает его основам работы с системой контроля версий Git. Алексей уже слышал о Git, но никогда не использовал его в практике. Оля объясняет ему, как создавать репозитории, коммитить изменения и работать с ветками.
Диалог на встрече:
Olya:
«Hi, Alexey! Today, I’m going to show you how to use Git for version control. Are you familiar with it?»
Alexey:
«I’ve heard about Git, but I’ve never actually used it. Can you explain how it works?»
Olya:
«Sure! Git is a version control system that helps you track changes in your code. The first step is to initialize a repository using the command git init.»
Alexey:
«Okay, so what happens after I create the repository?»
Olya:
«Once you’ve created the repository, you can start adding files to it using git add <filename>. After that, you make a commit to save your changes to the local repository with git commit -m «Your commit message’.»
Alexey:
«Do I need to push these changes to a remote server like GitHub?»
Olya:
«Exactly! To share your changes with others, you use the git push command to upload them to a remote repository. And to get the latest changes from the remote, you use git pull.»
Alexey:
«What about working on different features at the same time? Can I do that?»
Olya:
«Yes! You can create branches for each feature. For example, use git branch <branch_name> to create a new branch, and then switch between branches using git checkout <branch_name>.»
Alexey:
«This sounds useful! What if there’s a conflict between the changes in different branches?»
Olya:
«If two people change the same line of code in different branches, Git will report a merge conflict. You’ll need to manually resolve it by editing the file and then committing the changes.»
Alexey:
«Got it! I’ll start using Git for my projects from now on.»
Полезные фразы и выражения
Git repository – репозиторий Git (место для хранения проекта).
git init – команда для инициализации репозитория.
git add – команда для добавления файлов в индекс.
git commit – команда для сохранения изменений в локальном репозитории.
git push – команда для отправки изменений на удалённый сервер.
git pull – команда для получения изменений с удалённого сервера.
git branch – команда для создания новой ветки.
git checkout – команда для переключения между ветками.
Merge conflict – конфликт слияния (когда изменения из разных веток не могут быть автоматически объединены).
Упражнения
1. Vocabulary Match:
Соедините английские фразы с их русскими эквивалентами:
Git repository
git init
git add
git commit
Merge conflict
a) Репозиторий Git
b) Конфликт слияния
c) Команда для инициализации репозитория
d) Команда для добавления файлов
e) Команда для сохранения изменений
2. Fill in the blanks:
Заполните пропуски подходящими словами из списка:
«To initialize a new Git repository, use the command ______.»
«After modifying files, you need to ______ them before committing.»
«Use ______ to upload your local changes to a remote repository.»
«If there are changes in two branches that can’t be automatically merged, you’ll have a ______.»
(Answers: git init, git add, git push, merge conflict)
3. Translate the following sentences into English:
Для начала работы с Git, нужно инициализировать репозиторий.
Используйте команду git push, чтобы отправить изменения на сервер.
Если изменения из двух веток не могут быть объединены, возникает конфликт слияния.
4. Conversation Practice:
Практикуйте диалог с партнером или самостоятельно, используя фразы из главы. Один из вас будет играть роль Оли, а другой – Алексея. Пример:
Person 1 (Olya): «Did you use git commit to save your changes?»
Person 2 (Alexey): «Yes, I committed my changes after adding the files.»
Самопроверка:
What command do you use to initialize a new Git repository?
a) git commit
b) git init
c) git add
What is the purpose of the git push command?
a) To save changes locally
b) To upload changes to a remote server
c) To get updates from the remote repository
What happens when there is a merge conflict?
a) Git automatically resolves it
b) You need to manually resolve it
c) The repository is deleted
Ответы
1. Vocabulary Match:
1 – a
2 – c
3 – d
4 – e
5 – b
2. Fill in the blanks:
«To initialize a new Git repository, use the command git init.»
«After modifying files, you need to git add them before committing.»
«Use git push to upload your local changes to a remote repository.»
«If there are changes in two branches that can’t be automatically merged, you’ll have a merge conflict.»
3. Translate the sentences:
To start working with Git, you need to initialize the repository.
Use the git push command to send your changes to the server.
If changes from two branches cannot be merged, a merge conflict occurs.
4. Self-Check:
b) git init
b) To upload changes to a remote server
b) You need to manually resolve it