Родитель
99345f1b4f
Сommit
a40fa75fbc
@ -0,0 +1,895 @@
|
|||||||
|
Отчёт по лабораторной работе №2 «Система контроля версий Git»
|
||||||
|
|
||||||
|
Выполнила: Артеменко А.Е.
|
||||||
|
Группа: А-01-24
|
||||||
|
|
||||||
|
1. Вход в терминал и создание структуры каталогов
|
||||||
|
Создаю на рабочем столе каталог lab02 и запускаю в нём Git Bash, мне выводит приглашение:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02
|
||||||
|
$
|
||||||
|
Смотрю файлы в рабочем каталоге с помощью команды ls, так как в каталоге пусто, ls ничего не выводит:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02
|
||||||
|
$ ls
|
||||||
|
Создаю папки Алисы и Боба:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02
|
||||||
|
$ mkdir alice
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02
|
||||||
|
$ mkdir bob
|
||||||
|
|
||||||
|
Перехожу в каталог Алисы с помощью команды cd и создаю в ней папку project.
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02
|
||||||
|
$ cd alice
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice
|
||||||
|
$ mkdir project
|
||||||
|
Выполняю вход в каталог cd, а после поднимаю на уровень выше cd .. и снова возвращаюсь в папку project
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice
|
||||||
|
$ cd project
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project
|
||||||
|
$ cd ..
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice
|
||||||
|
$ cd project
|
||||||
|
|
||||||
|
1. Инициализация репозитария и настройка Git
|
||||||
|
Инициализируем репозиторий в текущем каталоге project:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project
|
||||||
|
$ git init
|
||||||
|
Initialized empty Git repository in C:/Users/user/Desktop/lab02/alice/project/.git/
|
||||||
|
|
||||||
|
К приглашению командной строки добавилось (master): имя текущий ветви Git.
|
||||||
|
|
||||||
|
Меняю текущее имя ветви master на имя main.
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (master)
|
||||||
|
$ git branch -m main
|
||||||
|
|
||||||
|
Настраиваю репозитарий Алисы:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git config user.name 'Alice (ArtemenkoAY)'
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git config user.email 'ArtemenkoAY@mpei.ru'
|
||||||
|
|
||||||
|
2. Создание коммитов
|
||||||
|
Посмотрим состояние рабочей копии:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git status
|
||||||
|
On branch main
|
||||||
|
|
||||||
|
No commits yet
|
||||||
|
|
||||||
|
Untracked files:
|
||||||
|
(use "git add <file>..." to include in what will be committed)
|
||||||
|
bin/
|
||||||
|
main.cpp
|
||||||
|
obj/
|
||||||
|
project.cbp
|
||||||
|
project.layout
|
||||||
|
|
||||||
|
nothing added to commit but untracked files present (use "git add" to track)
|
||||||
|
|
||||||
|
1 строка – говорит о том, что мы находимся на ветке main.
|
||||||
|
2 строка – говорит о том, что коммиты отсутствуют.
|
||||||
|
3, 5-7 строки – показывает файлы, которые не отслеживаются git.
|
||||||
|
4 строка – подсказывает, как создать коммит.
|
||||||
|
8 строка – подсказывает, что нет коммитом, но есть не отслеживаемые файлы, которые можно закоммитить.
|
||||||
|
|
||||||
|
Добавим файл main.cpp в индекс, то есть в набор изменений, который войдет в очередной коммит:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
Смотрю состояние рабочей копии:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git status
|
||||||
|
On branch main
|
||||||
|
Changes to be committed:
|
||||||
|
(use "git restore --staged <file>..." to unstage)
|
||||||
|
new file: main.cpp
|
||||||
|
|
||||||
|
Untracked files:
|
||||||
|
(use "git add <file>..." to include in what will be committed)
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
project.cbp
|
||||||
|
project.layout
|
||||||
|
|
||||||
|
Появилась строка с файлом, который можно добавить в коммит.
|
||||||
|
Выполним коммит с файлом main.cpp и коротким сообщением:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'code: заготовка программы'
|
||||||
|
[main (root-commit) f4f7fa5] code: заготовка программы
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
create mode 100644 main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git status
|
||||||
|
On branch main
|
||||||
|
Untracked files:
|
||||||
|
(use "git add <file>..." to include in what will be committed)
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
project.cbp
|
||||||
|
project.layout
|
||||||
|
|
||||||
|
nothing added to commit but untracked files present (use "git add" to track)
|
||||||
|
|
||||||
|
Теперь добавим файл project.cbp, т.е. проделаем тот же самый алгоритм
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add project.cbp
|
||||||
|
warning: in the working copy of 'project.cbp', LF will be replaced by CRLF the next time Git touches it
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git status
|
||||||
|
On branch main
|
||||||
|
Changes to be committed:
|
||||||
|
(use "git restore --staged <file>..." to unstage)
|
||||||
|
new file: project.cbp
|
||||||
|
|
||||||
|
Untracked files:
|
||||||
|
(use "git add <file>..." to include in what will be committed)
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
project.layout
|
||||||
|
|
||||||
|
Выполним коммит с файлом project.cbp и коротким сообщением
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'build: добавлен файл проекта'
|
||||||
|
[main 6ee4e6b] build: добавлен файл проекта
|
||||||
|
1 file changed, 38 insertions(+)
|
||||||
|
create mode 100644 project.cbp
|
||||||
|
|
||||||
|
Меняю тело функции main() на ввод двух чисел, смотрю состояние репозитория:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git status
|
||||||
|
On branch main
|
||||||
|
Changes not staged for commit:
|
||||||
|
(use "git add <file>..." to update what will be committed)
|
||||||
|
(use "git restore <file>..." to discard changes in working directory)
|
||||||
|
modified: main.cpp
|
||||||
|
|
||||||
|
Untracked files:
|
||||||
|
(use "git add <file>..." to include in what will be committed)
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
project.layout
|
||||||
|
|
||||||
|
no changes added to commit (use "git add" and/or "git commit -a")
|
||||||
|
|
||||||
|
1 строка – говорит о том, что мы находимся на основной ветке.
|
||||||
|
2-4 строки – предлагают удалить изменения или обновить коммит.
|
||||||
|
5 - строка пишет, что файл main.cpp был изменен.
|
||||||
|
6-10 строки – не отслеживаемые файлы.
|
||||||
|
|
||||||
|
Проделываем ряд изменений с кодом программы и делаем коммиты суммы и разности:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'code: вывод суммы'
|
||||||
|
[main 13bafc2] code: вывод суммы
|
||||||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add -u
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'code: вывод разности'
|
||||||
|
[main 149da8c] code: вывод разности
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
3. Игнорирование файлов
|
||||||
|
Создаю в CodeBlocks файл .gitignore, где будут написаны названия файлов, которые нужно будет игнорировать. Данный файл также коммичу.
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add .gitignore
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'git: игнорирование файлов'
|
||||||
|
[main c03016f] git: игнорирование файлов
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
create mode 100644 .gitignore
|
||||||
|
|
||||||
|
Проверяю, чтобы необходимые файлы и каталоги не отображались:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git status
|
||||||
|
On branch main
|
||||||
|
nothing to commit, working tree clean
|
||||||
|
|
||||||
|
4. Просмотр истории
|
||||||
|
Работа с журналом репозитария:
|
||||||
|
Команда git log --stat, которая показывает файлы, изменённые в коммитах:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log --stat
|
||||||
|
commit c03016f9f6abb51433cd08096949acef2648472c (HEAD -> main)
|
||||||
|
commit c03016f9f6abb51433cd08096949acef2648472c (HEAD -> main)
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:51:53 2025 +0300
|
||||||
|
|
||||||
|
git: игнорирование файлов
|
||||||
|
|
||||||
|
.gitignore | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
commit 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:41:41 2025 +0300
|
||||||
|
|
||||||
|
code: вывод разности
|
||||||
|
|
||||||
|
main.cpp | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
commit 13bafc29058a21adaec5542b3d8f901bd397c7ed
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:39:44 2025 +0300
|
||||||
|
|
||||||
|
code: вывод суммы
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log --main.cpp
|
||||||
|
fatal: unrecognized argument: --main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log -- main.cpp
|
||||||
|
commit 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:41:41 2025 +0300
|
||||||
|
|
||||||
|
code: вывод разности
|
||||||
|
|
||||||
|
commit 13bafc29058a21adaec5542b3d8f901bd397c7ed
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:39:44 2025 +0300
|
||||||
|
|
||||||
|
code: вывод суммы
|
||||||
|
|
||||||
|
commit f4f7fa5d1bb021ac6732ce0ba0fd23d0b9cc0c01
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:32:18 2025 +0300
|
||||||
|
|
||||||
|
code: заготовка программы
|
||||||
|
|
||||||
|
Для последнего коммита данная команда показывает:
|
||||||
|
1 строка - хэш коммита
|
||||||
|
2 строка - автор
|
||||||
|
3 строка - дата и время создания
|
||||||
|
4 строка - комментарий
|
||||||
|
5 строка - файл, который был изменён, количество изменённых строчек
|
||||||
|
6 строчка - статистика изменений данных файлов
|
||||||
|
|
||||||
|
Коммиты по теме build:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log --grep 'build'
|
||||||
|
commit 6ee4e6b18ec8209422a8ac1a41d406c9cdc43ca7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:36:01 2025 +0300
|
||||||
|
|
||||||
|
build: добавлен файл проекта
|
||||||
|
|
||||||
|
Коммиты, затрагивающие project.cbp:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log -- project.cbp
|
||||||
|
commit 6ee4e6b18ec8209422a8ac1a41d406c9cdc43ca7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:36:01 2025 +0300
|
||||||
|
|
||||||
|
build: добавлен файл проекта
|
||||||
|
|
||||||
|
Таким способом мы просмотрели информацию о коммите по измененному файлу и по теме коммита.
|
||||||
|
|
||||||
|
Просмотр коммитов:
|
||||||
|
Далее тремя эквивалентными способами просматриваем информацию о предпоследнем коммите.
|
||||||
|
|
||||||
|
1. При помощи отступа на 1 коммит:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git show HEAD~1
|
||||||
|
commit 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:41:41 2025 +0300
|
||||||
|
|
||||||
|
code: вывод разности
|
||||||
|
|
||||||
|
diff --git a/main.cpp b/main.cpp
|
||||||
|
index 1967dd8..f77bbcc 100644
|
||||||
|
--- a/main.cpp
|
||||||
|
+++ b/main.cpp
|
||||||
|
@@ -8,5 +8,6 @@ int main()
|
||||||
|
int a, b;
|
||||||
|
cin >> a >> b;
|
||||||
|
cout << "A + B = " << a + b << '\n';
|
||||||
|
+ cout << "A - B = " << a - b << '\n';
|
||||||
|
|
||||||
|
}
|
||||||
|
2. При помощи обращении к самой ветке main и отступу на 1 коммит:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git show main~1
|
||||||
|
commit 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:41:41 2025 +0300
|
||||||
|
|
||||||
|
code: вывод разности
|
||||||
|
|
||||||
|
diff --git a/main.cpp b/main.cpp
|
||||||
|
index 1967dd8..f77bbcc 100644
|
||||||
|
--- a/main.cpp
|
||||||
|
+++ b/main.cpp
|
||||||
|
@@ -8,5 +8,6 @@ int main()
|
||||||
|
int a, b;
|
||||||
|
cin >> a >> b;
|
||||||
|
cout << "A + B = " << a + b << '\n';
|
||||||
|
+ cout << "A - B = " << a - b << '\n';
|
||||||
|
|
||||||
|
}
|
||||||
|
3. Обращаясь к коммиту через его хеш
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git show 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
commit 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Sun Mar 23 19:41:41 2025 +0300
|
||||||
|
|
||||||
|
code: вывод разности
|
||||||
|
|
||||||
|
diff --git a/main.cpp b/main.cpp
|
||||||
|
index 1967dd8..f77bbcc 100644
|
||||||
|
--- a/main.cpp
|
||||||
|
+++ b/main.cpp
|
||||||
|
@@ -8,5 +8,6 @@ int main()
|
||||||
|
int a, b;
|
||||||
|
cin >> a >> b;
|
||||||
|
cout << "A + B = " << a + b << '\n';
|
||||||
|
+ cout << "A - B = " << a - b << '\n';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Просмотр изменений
|
||||||
|
|
||||||
|
Внесем изменения в main.cpp: добавим печать произведения чисел, но не станем пока делать коммит.
|
||||||
|
Просмотрим изменения в рабочей копии:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git diff
|
||||||
|
diff --git a/main.cpp b/main.cpp
|
||||||
|
index f77bbcc..8d75565 100644
|
||||||
|
--- a/main.cpp
|
||||||
|
+++ b/main.cpp
|
||||||
|
@@ -9,5 +9,5 @@ int main()
|
||||||
|
cin >> a >> b;
|
||||||
|
cout << "A + B = " << a + b << '\n';
|
||||||
|
cout << "A - B = " << a - b << '\n';
|
||||||
|
-
|
||||||
|
+ cout << "A * B = " << a * b << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
1 строка - файлы, которые сравнивает команда: a/main.cpp (старая версия файла) и b/main.cpp (новая версия файла).
|
||||||
|
2 строка - хэши старой и новой версий файла.
|
||||||
|
5 строка - в каких строках произошли изменения и количество строк в старом и новом файлах.
|
||||||
|
6 - 10 строка - показывает, что изменилось в строках, что осталось таким же.
|
||||||
|
|
||||||
|
Изменения между самым первым коммитом и коммитом, добавляющим вывод разности:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git diff f4f7fa5d1bb021ac6732ce0ba0fd23d0b9cc0c01 149da8cbebafc64e97026448c62d0ca592f1b1a7
|
||||||
|
diff --git a/main.cpp b/main.cpp
|
||||||
|
index b4392ec..f77bbcc 100644
|
||||||
|
--- a/main.cpp
|
||||||
|
+++ b/main.cpp
|
||||||
|
@@ -4,6 +4,10 @@ using namespace std;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
- cout << "Hello world!" << endl;
|
||||||
|
- return 0;
|
||||||
|
+ cout << "Enter A and B: ";
|
||||||
|
+ int a, b;
|
||||||
|
+ cin >> a >> b;
|
||||||
|
+ cout << "A + B = " << a + b << '\n';
|
||||||
|
+ cout << "A - B = " << a - b << '\n';
|
||||||
|
+
|
||||||
|
}
|
||||||
|
diff --git a/project.cbp b/project.cbp
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..c4697a9
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/project.cbp
|
||||||
|
@@ -0,0 +1,38 @@
|
||||||
|
|
||||||
|
|
||||||
|
5. Откат изменений
|
||||||
|
|
||||||
|
Закоммитим изменения в рабочей копии (вывод произведения):
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m: 'code: вывод произведения'
|
||||||
|
error: pathspec 'code: вывод произведения' did not match any file(s) known to git
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'code: вывод произведения'
|
||||||
|
[main c05dcd7] code: вывод произведения
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Вносим изменения в код, а потом откатываем их до состояния в определенном коммите с помощью команды git reset:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git reset --hard HEAD~1
|
||||||
|
HEAD is now at c03016f git: игнорирование файлов
|
||||||
|
Добавим над функцией main() комментарий:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ # you may type whatever you want
|
||||||
|
|
||||||
|
Уберем изменения в main.cpp другим способом — откатив этот файл к состоянию в последнем коммите (HEAD):
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git checkout HEAD -- main.cpp
|
||||||
|
|
||||||
|
6. Обмен кодом через удаленное хранилище
|
||||||
|
Обмен кодом через удалённое хранилище. Для загрузки данных в репозитарий GitHub будет использоваться протокол SSH. Поэтому для обмена данными с сервером нужно сгенерировать пару из открытого и закрытого ключей.
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ ssh-keygen
|
||||||
|
Generating public/private ed25519 key pair.
|
||||||
|
Enter file in which to save the key (/c/Users/user/.ssh/id_ed25519): 1234
|
||||||
|
Enter passphrase for "1234" (empty for no passphrase):
|
||||||
|
Enter same passphrase again:
|
||||||
|
Your identification has been saved in 1234
|
||||||
|
Your public key has been saved in 1234.pub
|
||||||
|
The key fingerprint is:
|
||||||
|
SHA256:TrF57TZXY8hnZk7BsMnOVdyMwMMX/7CO42xABSLAn1E user@WIN-0E2RN91IREF
|
||||||
|
The key's randomart image is:
|
||||||
|
+--[ED25519 256]--+
|
||||||
|
| .....E .+.o.=o|
|
||||||
|
| . .. . * B.=|
|
||||||
|
| . o. . *.+.|
|
||||||
|
| o +..+ ooo|
|
||||||
|
| S.. .=.Oo|
|
||||||
|
| o ... oO..|
|
||||||
|
| . .* o. |
|
||||||
|
| +.+ |
|
||||||
|
| .o |
|
||||||
|
+----[SHA256]-----+
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ eval $(ssh-agent -s)
|
||||||
|
Agent pid 1632
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ ssh-add
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ ssh-add 1234
|
||||||
|
Enter passphrase for 1234:
|
||||||
|
Identity added: 1234 (user@WIN-0E2RN91IREF)
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ cat 1234.pub
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJsfdrIXpoRC8oz8Yb0nvDW/14kGjNtiaxVJW+gq2zje user@WIN-0E2RN91IREF
|
||||||
|
|
||||||
|
Добавим репозитарий на который будем загружать хранилище git, и загрузим хранилище git на GitHub с помощью команды git push:
|
||||||
|
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git remote set-url origin http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git push -u origin main
|
||||||
|
warning: auto-detection of host provider took too long (>2000ms)
|
||||||
|
warning: see https://aka.ms/gcm/autodetect for more information.
|
||||||
|
warning: use of unencrypted HTTP remote URLs is not recommended; see https://aka.ms/gcm/unsaferemotes for more information.
|
||||||
|
warning: auto-detection of host provider took too long (>2000ms)
|
||||||
|
warning: see https://aka.ms/gcm/autodetect for more information.
|
||||||
|
Enumerating objects: 15, done.
|
||||||
|
Counting objects: 100% (15/15), done.
|
||||||
|
Delta compression using up to 4 threads
|
||||||
|
Compressing objects: 100% (13/13), done.
|
||||||
|
Writing objects: 100% (15/15), 2.00 KiB | 146.00 KiB/s, done.
|
||||||
|
Total 15 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||||
|
remote: . Processing 1 references
|
||||||
|
remote: Processed 1 references in total
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
* [new branch] main -> main
|
||||||
|
branch 'main' set up to track 'origin/main'.
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git remote -v
|
||||||
|
origin http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git (fetch)
|
||||||
|
origin http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git (push)
|
||||||
|
|
||||||
|
Получение проекта с сервера
|
||||||
|
Предположим, к разработке проекта присоединяется Боб. Откроем рабочую копию с машины Боба:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob
|
||||||
|
$ git clone http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git project
|
||||||
|
Cloning into 'project'...
|
||||||
|
remote: Enumerating objects: 15, done.
|
||||||
|
remote: Counting objects: 100% (15/15), done.
|
||||||
|
remote: Compressing objects: 100% (13/13), done.
|
||||||
|
remote: Total 15 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||||
|
Receiving objects: 100% (15/15), done.
|
||||||
|
Resolving deltas: 100% (1/1), done.
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob
|
||||||
|
$ cd project
|
||||||
|
|
||||||
|
Настроим хранилище Боба:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git config user.name 'Bob (ArtemenkoAY)'
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git config user.email 'ArtemenkoAYI@mpei.ru'
|
||||||
|
|
||||||
|
7. Совместная работа над проектом без конфликтов правок
|
||||||
|
Боб добавляет новый коммит, опережающий версию на сервере, и загружает его на GitHub.
|
||||||
|
«На машине Боба» добавляем в программу печать произведения чисел и делаем коммит:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git commit -m 'code: вывод произведения'
|
||||||
|
[main 98cdbca] code: вывод произведения
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
Отправляем коммит на сервер:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git push
|
||||||
|
warning: auto-detection of host provider took too long (>2000ms)
|
||||||
|
warning: see https://aka.ms/gcm/autodetect for more information.
|
||||||
|
Enumerating objects: 5, done.
|
||||||
|
Counting objects: 100% (5/5), done.
|
||||||
|
Delta compression using up to 4 threads
|
||||||
|
Compressing objects: 100% (3/3), done.
|
||||||
|
Writing objects: 100% (3/3), 420 bytes | 140.00 KiB/s, done.
|
||||||
|
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||||
|
remote: . Processing 1 references
|
||||||
|
remote: Processed 1 references in total
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
c03016f..98cdbca main -> main
|
||||||
|
|
||||||
|
«На машине Алисы» (то есть в первом терминале, в каталоге alice/project) выполните загрузку изменений:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git fetch
|
||||||
|
remote: Enumerating objects: 5, done.
|
||||||
|
remote: Counting objects: 100% (5/5), done.
|
||||||
|
remote: Compressing objects: 100% (3/3), done.
|
||||||
|
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||||
|
Unpacking objects: 100% (3/3), 400 bytes | 14.00 KiB/s, done.
|
||||||
|
From http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02
|
||||||
|
c03016f..98cdbca main -> origin/main
|
||||||
|
|
||||||
|
Убедимся, что в рабочей копии изменений еще не произошло.
|
||||||
|
Для этого посмотрим историю всех веток:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log --oneline --decorate --all --graph
|
||||||
|
* 98cdbca (origin/main, origin/HEAD) code: вывод произведения
|
||||||
|
* c03016f (HEAD -> main) git: игнорирование файлов
|
||||||
|
* 149da8c code: вывод разности
|
||||||
|
* 13bafc2 code: вывод суммы
|
||||||
|
* 6ee4e6b build: добавлен файл проекта
|
||||||
|
* f4f7fa5 code: заготовка программы
|
||||||
|
|
||||||
|
Как можно видеть, ветка main отстает на один коммит от ветки origin/main. Продвинем ветку main к скачанной версии:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git pull --ff-only
|
||||||
|
Updating c03016f..98cdbca
|
||||||
|
Fast-forward
|
||||||
|
main.cpp | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
«От имени Алисы» добавляем в программу печать деления, а после коммит:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'code: вывод деления'
|
||||||
|
[main 103f0b2] code: вывод деления
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Загружаем изменения на сервер:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git push
|
||||||
|
Enumerating objects: 5, done.
|
||||||
|
Counting objects: 100% (5/5), done.
|
||||||
|
Delta compression using up to 4 threads
|
||||||
|
Compressing objects: 100% (3/3), done.
|
||||||
|
Writing objects: 100% (3/3), 401 bytes | 401.00 KiB/s, done.
|
||||||
|
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||||
|
remote: . Processing 1 references
|
||||||
|
remote: Processed 1 references in total
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
98cdbca..103f0b2 main -> main
|
||||||
|
|
||||||
|
И получаем новую версию «на машине Боба»:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git fetch
|
||||||
|
remote: Enumerating objects: 5, done.
|
||||||
|
remote: Counting objects: 100% (5/5), done.
|
||||||
|
remote: Compressing objects: 100% (3/3), done.
|
||||||
|
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||||
|
Unpacking objects: 100% (3/3), 381 bytes | 6.00 KiB/s, done.
|
||||||
|
From http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02
|
||||||
|
98cdbca..103f0b2 main -> origin/main
|
||||||
|
|
||||||
|
Ветка main, как мы знаем, отстает на один коммит от ветки origin/main. Продвинем ветку main к скачанной версии:
|
||||||
|
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git pull --ff-only
|
||||||
|
Updating 98cdbca..103f0b2
|
||||||
|
Fast-forward
|
||||||
|
main.cpp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
8. Разрешение конфликтов правок при совместной работе
|
||||||
|
Далее, Алиса решает добавить в программу печать максимума из чисел, а Боб — минимума.
|
||||||
|
От лица Алисы, добавляем печать максимума:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git commit -m 'code: вывод максимума'
|
||||||
|
[main d777285] code: вывод максимума
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
Загружаем изменения на сервер от лица Алисы:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git push
|
||||||
|
Enumerating objects: 5, done.
|
||||||
|
Counting objects: 100% (5/5), done.
|
||||||
|
Delta compression using up to 4 threads
|
||||||
|
Compressing objects: 100% (3/3), done.
|
||||||
|
Writing objects: 100% (3/3), 409 bytes | 204.00 KiB/s, done.
|
||||||
|
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||||
|
remote: . Processing 1 references
|
||||||
|
remote: Processed 1 references in total
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
103f0b2..d777285 main -> main
|
||||||
|
|
||||||
|
От лица Боб, добавляем печать минимума:
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git commit -m 'code: вывод минимума'
|
||||||
|
[main d84e249] code: вывод минимума
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
|
||||||
|
Загружаем изменения на сервер от лица Боба:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git push
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
! [rejected] main -> main (fetch first)
|
||||||
|
error: failed to push some refs to 'http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git'
|
||||||
|
hint: Updates were rejected because the remote contains work that you do not
|
||||||
|
hint: have locally. This is usually caused by another repository pushing to
|
||||||
|
hint: the same ref. If you want to integrate the remote changes, use
|
||||||
|
hint: 'git pull' before pushing again.
|
||||||
|
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
|
||||||
|
|
||||||
|
|
||||||
|
Однако загрузить на сервер изменения получается только у Алисы потому, что Боб затем пытается загрузить версию, основанную на более старом коммите, чем самый новый коммит в репозитарии GitHub.
|
||||||
|
Загрузим версию с сервера:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git fetch
|
||||||
|
remote: Enumerating objects: 5, done.
|
||||||
|
remote: Counting objects: 100% (5/5), done.
|
||||||
|
remote: Compressing objects: 100% (3/3), done.
|
||||||
|
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||||
|
Unpacking objects: 100% (3/3), 389 bytes | 7.00 KiB/s, done.
|
||||||
|
From http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02
|
||||||
|
103f0b2..d777285 main -> origin/main
|
||||||
|
|
||||||
|
Можно видеть, что ветка main локального репозитария разошлась с веткой origin/main, то есть с веткой main на сервере.
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git log --oneline --decorate --all --graph
|
||||||
|
* d84e249 (HEAD -> main) code: вывод минимума
|
||||||
|
| * d777285 (origin/main, origin/HEAD) code: вывод максимума
|
||||||
|
|/
|
||||||
|
* 103f0b2 code: вывод деления
|
||||||
|
* 98cdbca code: вывод произведения
|
||||||
|
* c03016f git: игнорирование файлов
|
||||||
|
* 149da8c code: вывод разности
|
||||||
|
* 13bafc2 code: вывд суммы
|
||||||
|
* 6ee4e6b build: добавлен файл проекта
|
||||||
|
* f4f7fa5 code: заготовка программы
|
||||||
|
|
||||||
|
Бобу нужно переместить свой коммит поверх коммита Алисы, то есть поверх origin/main:
|
||||||
|
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git rebase origin/main
|
||||||
|
Auto-merging main.cpp
|
||||||
|
CONFLICT (content): Merge conflict in main.cpp
|
||||||
|
error: could not apply d84e249... code: вывод минимума
|
||||||
|
hint: Resolve all conflicts manually, mark them as resolved with
|
||||||
|
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
|
||||||
|
hint: You can instead skip this commit: run "git rebase --skip".
|
||||||
|
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
|
||||||
|
hint: Disable this message with "git config set advice.mergeConflict false"
|
||||||
|
Could not apply d84e249... code: вывод минимума
|
||||||
|
|
||||||
|
Комманда завершается с ошибкой из-за конфликта в файле с кодом main.cpp. Производный файл от файла Алисы и Боба записывается в рабочую копию с помеченными метками конфликта. Убираем метки конфликта, и дорабатываем код так, чтобы программа компилировалась и работала. Затем загружаем изменения в индекс и продолжаем операцию git rebase, с помощью флага –continue.
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main|REBASE 1/1)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main|REBASE 1/1)
|
||||||
|
$ git rebase --continue
|
||||||
|
hint: Waiting for your editor to close the file...
|
||||||
|
(electron) Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reporting servers support.
|
||||||
|
(node:12404) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\superstring\build\Release\superstring.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\pathwatcher\build\Release\pathwatcher.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\oniguruma\build\Release\onig_scanner.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-c\build\Release\tree_sitter_c_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-cpp\build\Release\tree_sitter_cpp_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-css\build\Release\tree_sitter_css_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-go\build\Release\tree_sitter_go_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-embedded-template\build\Release\tree_sitter_embedded_template_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-html\build\Release\tree_sitter_html_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-java-dev\build\Release\tree_sitter_java_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-javascript\build\Release\tree_sitter_javascript_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-jsdoc\build\Release\tree_sitter_jsdoc_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-regex\build\Release\tree_sitter_regex_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-json\build\Release\tree_sitter_json_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-python\build\Release\tree_sitter_python_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-ruby\build\Release\tree_sitter_ruby_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-rust\build\Release\tree_sitter_rust_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-bash\build\Release\tree_sitter_bash_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_tsx_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\tree-sitter-typescript\build\Release\tree_sitter_typescript_binding.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:12404) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\spellchecker\build\Release\spellchecker.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\git-utils\build\Release\git.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
(node:2328) Electron: Loading non-context-aware native module in renderer: '\\?\C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar.unpacked\node_modules\@atom\nsfw\build\Release\nsfw.node'. This is deprecated, see https://github.com/electron/electron/issues/18397.
|
||||||
|
Attempting to call a function in a renderer window that has been closed or released.
|
||||||
|
Function provided here: Object.<anonymous> (C:\Users\user\AppData\Local\atom\app-1.63.1\resources\app.asar\node_modules\github\lib\worker.js:64:22
|
||||||
|
Remote event names: crashed, destroyed
|
||||||
|
[detached HEAD 92cf582] code: вывод минимума
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
Successfully rebased and updated refs/heads/main.
|
||||||
|
|
||||||
|
Отправим изменения на сервер:
|
||||||
|
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/bob/project (main)
|
||||||
|
$ git push
|
||||||
|
Enumerating objects: 5, done.
|
||||||
|
Counting objects: 100% (5/5), done.
|
||||||
|
Delta compression using up to 4 threads
|
||||||
|
Compressing objects: 100% (3/3), done.
|
||||||
|
Writing objects: 100% (3/3), 416 bytes | 208.00 KiB/s, done.
|
||||||
|
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||||
|
remote: . Processing 1 references
|
||||||
|
remote: Processed 1 references in total
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
d777285..92cf582 main -> main
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git pull --ff-only
|
||||||
|
remote: Enumerating objects: 5, done.
|
||||||
|
remote: Counting objects: 100% (5/5), done.
|
||||||
|
remote: Compressing objects: 100% (3/3), done.
|
||||||
|
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||||
|
Unpacking objects: 100% (3/3), 396 bytes | 7.00 KiB/s, done.
|
||||||
|
From http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02
|
||||||
|
d777285..92cf582 main -> origin/main
|
||||||
|
Updating d777285..92cf582
|
||||||
|
Fast-forward
|
||||||
|
main.cpp | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log
|
||||||
|
commit 92cf5822e746a681143206a7f8ca57857507fb73 (HEAD -> main, origin/main, origin/HEAD)
|
||||||
|
Author: Bob (ArtemenkoAY) <ArtemenkoAYI@mpei.ru>
|
||||||
|
Date: Mon Mar 24 16:11:57 2025 +0300
|
||||||
|
|
||||||
|
code: вывод минимума
|
||||||
|
|
||||||
|
commit d7772852e578b47185b4140824dc02cfa8744c3c
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Mon Mar 24 16:07:07 2025 +0300
|
||||||
|
|
||||||
|
code: вывод максимума
|
||||||
|
|
||||||
|
commit 103f0b2532c5cfefe97a5bdd8e6bf13957204757
|
||||||
|
Author: Alice (ArtemenkoAY) <ArtemenkoAY@mpei.ru>
|
||||||
|
Date: Mon Mar 24 13:38:56 2025 +0300
|
||||||
|
|
||||||
|
code: вывод деления
|
||||||
|
|
||||||
|
commit 98cdbca4cd7bdfbd5795c326962db6de9e775736
|
||||||
|
Author: Bob (ArtemenkoAY) <ArtemenkoAYI@mpei.ru>
|
||||||
|
Date: Mon Mar 24 13:25:54 2025 +0300
|
||||||
|
|
||||||
|
|
||||||
|
Получили желаемый результат.
|
||||||
|
9. Использование веток
|
||||||
|
Пока Боб синхронизирует изменения, Алиса меняет целые числа на действительные, для этого создадим отдельную ветку double т.к. это может занять время.
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git branch double
|
||||||
|
|
||||||
|
Переключаюсь с ветки main на ветку double:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git checkout double
|
||||||
|
Switched to branch 'double'
|
||||||
|
|
||||||
|
Меняем тип данных и коммитим изменения в файле:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (double)
|
||||||
|
$ git add main.cpp
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (double)
|
||||||
|
$ git commit -m 'code: изменение типа данных'
|
||||||
|
[double 44e5418] code: изменение типа данных
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Обратно переключаемся на ветку main:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (double)
|
||||||
|
$ git checkout main
|
||||||
|
Switched to branch 'main'
|
||||||
|
Your branch is up to date with 'origin/main'.
|
||||||
|
|
||||||
|
Синхронизируем ветку main:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git fetch
|
||||||
|
Получаем одновременно две ветки:
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git log --oneline --decorate --all --graph
|
||||||
|
* 44e5418 (double) code: изменение типа данных
|
||||||
|
* 92cf582 (HEAD -> main, origin/main, origin/HEAD) code: вывод минимума
|
||||||
|
* d777285 code: вывод максимума
|
||||||
|
* 103f0b2 code: вывод деления
|
||||||
|
* 98cdbca code: вывод произведения
|
||||||
|
* c03016f git: игнорирование файлов
|
||||||
|
* 149da8c code: вывод разности
|
||||||
|
* 13bafc2 code: вывод суммы
|
||||||
|
* 6ee4e6b build: добавлен файл проекта
|
||||||
|
* f4f7fa5 code: заготовка программы
|
||||||
|
|
||||||
|
|
||||||
|
Объединяем ветки double и main. Вносим последние изменения и загружаем на GitHub.
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git merge double
|
||||||
|
Updating 92cf582..44e5418
|
||||||
|
Fast-forward
|
||||||
|
main.cpp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
user@WIN-0E2RN91IREF MINGW64 ~/Desktop/lab02/alice/project (main)
|
||||||
|
$ git push
|
||||||
|
Enumerating objects: 5, done.
|
||||||
|
Counting objects: 100% (5/5), done.
|
||||||
|
Delta compression using up to 4 threads
|
||||||
|
Compressing objects: 100% (3/3), done.
|
||||||
|
Writing objects: 100% (3/3), 396 bytes | 198.00 KiB/s, done.
|
||||||
|
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||||
|
remote: . Processing 1 references
|
||||||
|
remote: Processed 1 references in total
|
||||||
|
To http://uit.mpei.ru/git/ArtemenkoAY/cs-lab02.git
|
||||||
|
92cf582..44e5418 main -> main
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче