Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
1004 строки
37 KiB
Plaintext
1004 строки
37 KiB
Plaintext
Отчет по лабораторной работе № 2 "Система контроля версий Git"
|
|
|
|
|
|
|
|
Выполнил: Анисенокв П. Д.
|
|
|
|
Группа: А-01-23
|
|
|
|
Проверил: _
|
|
|
|
|
|
|
|
Примечание: работа выполнялась на Windows.
|
|
|
|
|
|
1. Создал на рабочем столе каталог lab02 с текстовым документом и запустил в нем Git Bash, приглашение:
|
|
|
|
2. Просмотр файлов в рабочем каталоге осуществляется командой "ls" (там текстовый документ):
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002
|
|
$ ls
|
|
'Новый текстовый документ.txt'
|
|
|
|
3. Создал каталоги Алисы и Боба, создал каталог "project",
|
|
изучил команду перехода между каталогами "cd":
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002
|
|
$ mkdir alice
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002
|
|
$ mkdir bob
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002
|
|
$ cd alice
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice
|
|
$ mkdir project
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice
|
|
$ cd ..
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002
|
|
$ cd project
|
|
bash: cd: project: No such file or directory
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002
|
|
$ cd alice
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice
|
|
$ cd project
|
|
|
|
4. Инициализировал репозитарий:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project
|
|
$ git init
|
|
Initialized empty Git repository in C:/Users/Professional/Desktop/lab002/alice/project/.git/
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ ls -A
|
|
.git/
|
|
|
|
5. Настроил репозитарий Алисы, чтобы коммиты были от её имени:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git config user.name 'Alice (AnisenkovPD)'
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git config user.email 'AnisenkovPD@mpei.ru'
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ ls -A
|
|
.git/ bin/ main.cpp obj/ project.cbp
|
|
|
|
6.Проверил состояние рабочей папки
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git status
|
|
On branch master (на ветке мастер)
|
|
|
|
No commits yet (коммиты еще не сделаны)
|
|
|
|
Untracked files: (файлов под гитом нет)
|
|
(use "git add <file>..." to include in what will be committed)
|
|
bin/
|
|
main.cpp
|
|
obj/
|
|
project.cbp
|
|
|
|
nothing added to commit but untracked files present (use "git add" to track) (пока ничего не добавлено в коммит)
|
|
|
|
7. Начало отслеживания main.cpp и повторная проверка состояния.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git add main.cpp
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git status
|
|
On branch master
|
|
|
|
No commits yet
|
|
|
|
Changes to be committed:
|
|
(use "git rm --cached <file>..." to unstage)
|
|
new file: main.cpp (занесен под гит)
|
|
|
|
Untracked files:
|
|
(use "git add <file>..." to include in what will be committed)
|
|
bin/
|
|
obj/
|
|
project.cbp
|
|
8. Создание первого коммита и переименование ветки (т.к. старая версия GIT)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git commit -m 'code: заготовка программы'
|
|
[master (root-commit) 3c52ad0] code: заготовка программы
|
|
1 file changed, 9 insertions(+)
|
|
create mode 100644 main.cpp
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (master)
|
|
$ git branch -m main
|
|
|
|
9.Занесение project.cbp под гит (его отслеживание) и создание коммита с ним.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/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
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -m 'build: добавлен файл проекта'
|
|
[main e70eec9] build: добавлен файл проекта
|
|
1 file changed, 38 insertions(+)
|
|
create mode 100644 project.cbp
|
|
|
|
10. Повторная проверка состояния
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/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 (изменение с "new file" на "modified", т.к. тело кода в main.cpp было изменено)
|
|
|
|
Untracked files:
|
|
(use "git add <file>..." to include in what will be committed)
|
|
bin/
|
|
obj/
|
|
|
|
no changes added to commit (use "git add" and/or "git commit -a")
|
|
|
|
11.Создание коммитов с изменениями разными способами.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git add main.cpp
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -m "code: добавлен ввод чисел"
|
|
[main 279b131] code: добавлен ввод чисел
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git add -u
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -m "добавлен вывод суммы"
|
|
[main 2462445] добавлен вывод суммы
|
|
1 file changed, 1 insertion(+)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -a -m "code: добавлен вывод разности"
|
|
[main fbeca29] code: добавлен вывод разности
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
12. Создание .gitignore:
|
|
13. Игнорирование bin, obj, project.layout:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git status
|
|
On branch main
|
|
Untracked files:
|
|
(use "git add <file>..." to include in what will be committed)
|
|
.gitignore
|
|
obj/
|
|
project.depend
|
|
|
|
nothing added to commit but untracked files present (use "git add" to track)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git status
|
|
On branch main
|
|
Untracked files:
|
|
(use "git add <file>..." to include in what will be committed)
|
|
.gitignore
|
|
project.depend
|
|
|
|
nothing added to commit but untracked files present (use "git add" to track)
|
|
|
|
14. Коммит для .gitignore
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git add .gitignore
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -m 'git: игнорирование бинарных файлов'
|
|
[main df9e3ba] git: игнорирование бинарных файлов
|
|
1 file changed, 2 insertions(+)
|
|
create mode 100644 .gitignore
|
|
|
|
15. Команда просмотра журнала репозитария:
|
|
git log --stat показывает файлы, измененные в коммитах.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log
|
|
commit df9e3ba81b1d11a139e1edb5a8ef12e012ab938f (HEAD -> main)
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:10:04 2024 +0300
|
|
|
|
git: игнорирование бинарных файлов
|
|
|
|
commit fbeca290b4b5f611c16e7437b7ff63650879a003
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:02:55 2024 +0300
|
|
|
|
code: добавлен вывод разности
|
|
|
|
commit 24624453512bc2728cd230fb99319d0949bd066b
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:00:23 2024 +0300
|
|
|
|
добавлен вывод суммы
|
|
|
|
commit 279b13130560ad509839ec1acbfc079e239458c7
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:58:12 2024 +0300
|
|
|
|
code: добавлен ввод чисел
|
|
|
|
commit e70eec93421bd15e89b69025506036e82d64a130
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:54:28 2024 +0300
|
|
|
|
build: добавлен файл проекта
|
|
|
|
commit 3c52ad0e77d67dfe2894cbdb565e338e606c3250
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:49:00 2024 +0300
|
|
|
|
code: заготовка программы
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --stat
|
|
commit df9e3ba81b1d11a139e1edb5a8ef12e012ab938f (HEAD -> main)
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:10:04 2024 +0300
|
|
|
|
git: игнорирование бинарных файлов (показывает занесение бинарных файлов в .gitignore)
|
|
|
|
.gitignore | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
commit fbeca290b4b5f611c16e7437b7ff63650879a003
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:02:55 2024 +0300
|
|
|
|
code: добавлен вывод разности
|
|
|
|
main.cpp | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
commit 24624453512bc2728cd230fb99319d0949bd066b
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:00:23 2024 +0300
|
|
|
|
добавлен вывод суммы
|
|
|
|
main.cpp | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
commit 279b13130560ad509839ec1acbfc079e239458c7
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:58:12 2024 +0300
|
|
|
|
code: добавлен ввод чисел
|
|
|
|
main.cpp | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
commit e70eec93421bd15e89b69025506036e82d64a130
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:54:28 2024 +0300
|
|
|
|
16. команда git log --oneline --decorate (показывает коммиты компактно (--oneline), а также показывает ссылки, концы веток и тэги (--decorate).)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git lof --oneline --decorate
|
|
git: 'lof' is not a git command. See 'git --help'.
|
|
|
|
The most similar command is
|
|
log
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --oneline --decorate
|
|
df9e3ba (HEAD -> main) git: игнорирование бинарных файлов
|
|
fbeca29 code: добавлен вывод разности
|
|
2462445 добавлен вывод суммы
|
|
279b131 code: добавлен ввод чисел
|
|
e70eec9 build: добавлен файл проекта
|
|
3c52ad0 code: заготовка программы
|
|
|
|
17. команда git log --oneline --decorate --all --graph (делает то же для всех веток (--all), причем коммиты отображаются в терминале в виде дерева (--graph).)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --oneline --decorate --all --graph
|
|
* df9e3ba (HEAD -> main) git: игнорирование бинарных файлов
|
|
* fbeca29 code: добавлен вывод разности
|
|
* 2462445 добавлен вывод суммы
|
|
* 279b131 code: добавлен ввод чисел
|
|
* e70eec9 build: добавлен файл проекта
|
|
* 3c52ad0 code: заготовка программы
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log -- main.cpp
|
|
commit fbeca290b4b5f611c16e7437b7ff63650879a003
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:02:55 2024 +0300
|
|
|
|
code: добавлен вывод разности
|
|
|
|
commit 24624453512bc2728cd230fb99319d0949bd066b
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:00:23 2024 +0300
|
|
|
|
добавлен вывод суммы
|
|
|
|
commit 279b13130560ad509839ec1acbfc079e239458c7
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:58:12 2024 +0300
|
|
|
|
code: добавлен ввод чисел
|
|
|
|
commit 3c52ad0e77d67dfe2894cbdb565e338e606c3250
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:49:00 2024 +0300
|
|
|
|
code: заготовка программы
|
|
|
|
18. Просмотр коммитов по теме 'code'
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --grep "code:"
|
|
commit fbeca290b4b5f611c16e7437b7ff63650879a003
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:02:55 2024 +0300
|
|
|
|
code: добавлен вывод разности
|
|
|
|
commit 279b13130560ad509839ec1acbfc079e239458c7
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:58:12 2024 +0300
|
|
|
|
code: добавлен ввод чисел
|
|
|
|
commit 3c52ad0e77d67dfe2894cbdb565e338e606c3250
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:49:00 2024 +0300
|
|
|
|
code: заготовка программы
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --grep "build:"
|
|
commit e70eec93421bd15e89b69025506036e82d64a130
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:54:28 2024 +0300
|
|
|
|
build: добавлен файл проекта
|
|
|
|
19. Просмотр коммитов, затрагивающих 'project.cbp'
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log -- project.cbp
|
|
commit e70eec93421bd15e89b69025506036e82d64a130
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 12:54:28 2024 +0300
|
|
|
|
build: добавлен файл проекта
|
|
|
|
20.Просмотр последнего коммита через текущую ветку:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git show HEAD
|
|
commit df9e3ba81b1d11a139e1edb5a8ef12e012ab938f (HEAD -> main)
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:10:04 2024 +0300
|
|
|
|
git: игнорирование бинарных файлов
|
|
|
|
diff --git a/.gitignore b/.gitignore
|
|
new file mode 100644
|
|
index 0000000..4c7473d
|
|
--- /dev/null
|
|
+++ b/.gitignore
|
|
@@ -0,0 +1,2 @@
|
|
+/bin
|
|
+/obj
|
|
|
|
20.Просмотр последнего коммита по имени ветки:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git show main
|
|
commit df9e3ba81b1d11a139e1edb5a8ef12e012ab938f (HEAD -> main)
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:10:04 2024 +0300
|
|
|
|
git: игнорирование бинарных файлов
|
|
|
|
diff --git a/.gitignore b/.gitignore
|
|
new file mode 100644
|
|
index 0000000..4c7473d
|
|
--- /dev/null
|
|
+++ b/.gitignore
|
|
@@ -0,0 +1,2 @@
|
|
+/bin
|
|
+/obj
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --oneline
|
|
df9e3ba (HEAD -> main) git: игнорирование бинарных файлов
|
|
fbeca29 code: добавлен вывод разности
|
|
2462445 добавлен вывод суммы
|
|
279b131 code: добавлен ввод чисел
|
|
e70eec9 build: добавлен файл проекта
|
|
3c52ad0 code: заготовка программы
|
|
|
|
21.Просмотр последнего коммита через хеш:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git show fbeca29
|
|
commit fbeca290b4b5f611c16e7437b7ff63650879a003
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:02:55 2024 +0300
|
|
|
|
code: добавлен вывод разности
|
|
|
|
diff --git a/main.cpp b/main.cpp
|
|
index 4364dbc..8435233 100644
|
|
--- a/main.cpp
|
|
+++ b/main.cpp
|
|
@@ -7,5 +7,6 @@ int main()
|
|
cout << "Enter A and B: ";
|
|
int a, b;
|
|
cin >> a >> b;
|
|
- cout << "A + B = " << a + b << '\n';
|
|
+ cout << "A + B = " << a + b << '\n'
|
|
+ << "A - B = " << a - b << '\n';
|
|
}
|
|
|
|
22.Просмотр предпоследнего коммита через текущую ветку:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git show HEAD~1
|
|
commit fbeca290b4b5f611c16e7437b7ff63650879a003
|
|
Author: Alice (AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 13:02:55 2024 +0300
|
|
|
|
code: добавлен вывод разности
|
|
|
|
diff --git a/main.cpp b/main.cpp
|
|
index 4364dbc..8435233 100644
|
|
--- a/main.cpp
|
|
+++ b/main.cpp
|
|
@@ -7,5 +7,6 @@ int main()
|
|
cout << "Enter A and B: ";
|
|
int a, b;
|
|
cin >> a >> b;
|
|
- cout << "A + B = " << a + b << '\n';
|
|
+ cout << "A + B = " << a + b << '\n'
|
|
+ << "A - B = " << a - b << '\n';
|
|
}
|
|
|
|
23. Просмотр изменений
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git diff
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git diff
|
|
diff --git a/main.cpp b/main.cpp
|
|
index 8435233..f372c78 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'
|
|
- << "A - B = " << a - b << '\n';
|
|
+ << "A - B = " << a - b << '\n'
|
|
+ << "A * B = " << a * b << '\n'; (добавлена печать произведения двух чисел.)
|
|
}
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git diff HEAD~2
|
|
diff --git a/.gitignore b/.gitignore
|
|
new file mode 100644
|
|
index 0000000..4c7473d
|
|
--- /dev/null
|
|
+++ b/.gitignore
|
|
@@ -0,0 +1,2 @@
|
|
+/bin
|
|
+/obj
|
|
diff --git a/main.cpp b/main.cpp
|
|
index 4364dbc..f372c78 100644
|
|
--- a/main.cpp
|
|
+++ b/main.cpp
|
|
@@ -7,5 +7,7 @@ int main()
|
|
cout << "Enter A and B: ";
|
|
int a, b;
|
|
cin >> a >> b;
|
|
- cout << "A + B = " << a + b << '\n';
|
|
+ cout << "A + B = " << a + b << '\n'
|
|
+ << "A - B = " << a - b << '\n'
|
|
+ << "A * B = " << a * b << '\n';
|
|
}
|
|
|
|
24. Выявление различия между самым первым коммитом и коммитом вывода разности:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git diff HEAD~2 HEAD
|
|
diff --git a/.gitignore b/.gitignore
|
|
new file mode 100644
|
|
index 0000000..4c7473d
|
|
--- /dev/null
|
|
+++ b/.gitignore
|
|
@@ -0,0 +1,2 @@
|
|
+/bin
|
|
+/obj
|
|
diff --git a/main.cpp b/main.cpp
|
|
index 4364dbc..8435233 100644
|
|
--- a/main.cpp
|
|
+++ b/main.cpp
|
|
@@ -7,5 +7,6 @@ int main()
|
|
cout << "Enter A and B: ";
|
|
int a, b;
|
|
cin >> a >> b;
|
|
- cout << "A + B = " << a + b << '\n';
|
|
+ cout << "A + B = " << a + b << '\n'
|
|
+ << "A - B = " << a - b << '\n';
|
|
}
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --oneline
|
|
df9e3ba (HEAD -> main) git: игнорирование бинарных файлов
|
|
fbeca29 code: добавлен вывод разности
|
|
2462445 добавлен вывод суммы
|
|
279b131 code: добавлен ввод чисел
|
|
e70eec9 build: добавлен файл проекта
|
|
3c52ad0 code: заготовка программы
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git diff fbeca29 3c52ad0
|
|
diff --git a/main.cpp b/main.cpp
|
|
index 8435233..b4392ec 100644
|
|
--- a/main.cpp
|
|
+++ b/main.cpp
|
|
@@ -4,9 +4,6 @@ using namespace std;
|
|
|
|
int main()
|
|
{
|
|
- cout << "Enter A and B: ";
|
|
- int a, b;
|
|
- cin >> a >> b;
|
|
- cout << "A + B = " << a + b << '\n'
|
|
- << "A - B = " << a - b << '\n';
|
|
+ cout << "Hello world!" << endl;
|
|
+ return 0;
|
|
}
|
|
diff --git a/project.cbp b/project.cbp
|
|
deleted file mode 100644
|
|
index c4697a9..0000000
|
|
--- a/project.cbp
|
|
+++ /dev/null
|
|
@@ -1,38 +0,0 @@
|
|
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
-<CodeBlocks_project_file>
|
|
- <FileVersion major="1" minor="6" />
|
|
- <Project>
|
|
- <Option title="project" />
|
|
- <Option pch_mode="2" />
|
|
- <Option compiler="gcc" />
|
|
- <Build>
|
|
- <Target title="Debug">
|
|
- <Option output="bin/Debug/project" prefix_auto="1" extension_auto="1" />
|
|
- <Option object_output="obj/Debug/" />
|
|
- <Option type="1" />
|
|
- <Option compiler="gcc" />
|
|
- <Compiler>
|
|
- <Add option="-g" />
|
|
- </Compiler>
|
|
|
|
25. Коммит печати произведения:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -a -m 'code: вывод произведения'
|
|
[main fd4fb0d] code: вывод произведения
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
26. Откат коммита к предыдущему
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git reset --hard HEAD~1
|
|
HEAD is now at df9e3ba git: игнорирование бинарных файлов (после добавления комментария)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git checkout HEAD -- main.cpp
|
|
|
|
27. Обмен кодом через удаленное хранилище
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ ssh-keygen
|
|
Generating public/private ed25519 key pair.
|
|
Enter file in which to save the key (/c/Users/Professional/.ssh/id_ed25519):
|
|
Created directory '/c/Users/Professional/.ssh'.
|
|
Enter passphrase (empty for no passphrase):
|
|
Enter same passphrase again:
|
|
Your identification has been saved in /c/Users/Professional/.ssh/id_ed25519
|
|
Your public key has been saved in /c/Users/Professional/.ssh/id_ed25519.pub
|
|
The key fingerprint is:
|
|
SHA256:u8vVaKe5xstjXU3R7zy7slImFxrSPLjrJW1Gn78NZRM Professional@User-PC
|
|
The key's randomart image is:
|
|
+--[ED25519 256]--+
|
|
| .|
|
|
| ..|
|
|
| + Eo|
|
|
| o = . +|
|
|
| S o.+ .*o|
|
|
| oo=.+o+=|
|
|
| .o=*B+. o|
|
|
| . *X=...o.|
|
|
| ==*+..o++|
|
|
+----[SHA256]-----+
|
|
|
|
28. Запуск агента:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ eval $(ssh-agent -s)
|
|
Agent pid 1867
|
|
|
|
29. Просмотр открытого ключа:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ ssh-add
|
|
Enter passphrase for /c/Users/Professional/.ssh/id_ed25519:
|
|
Identity added: /c/Users/Professional/.ssh/id_ed25519 (Professional@User-PC)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ cat ~/.ssh/id_ed25519.pub
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKaLvRCn18nBqSOo3bwzJzbUnEmKN6koXpXQoEKIvJOa Professional@User-PC
|
|
|
|
30. Отправка проекта на сервер:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git remote add origin http://uit.mpei.ru/git/AnisenkovPD/cs-lab002.git
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git push -u origin main
|
|
Enumerating objects: 18, done.
|
|
Counting objects: 100% (18/18), done.
|
|
Delta compression using up to 12 threads
|
|
Compressing objects: 100% (16/16), done.
|
|
Writing objects: 100% (18/18), 2.32 KiB | 1.16 MiB/s, done.
|
|
Total 18 (delta 2), 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/AnisenkovPD/cs-lab002.git
|
|
* [new branch] main -> main
|
|
branch 'main' set up to track 'origin/main'.
|
|
|
|
31) Клонирование проекта для Боба:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob
|
|
$ git clone http://uit.mpei.ru/git/AnisenkovPD/cs-lab002.git project
|
|
Cloning into 'project'...
|
|
remote: Enumerating objects: 18, done.
|
|
remote: Counting objects: 100% (18/18), done.
|
|
remote: Compressing objects: 100% (16/16), done.
|
|
remote: Total 18 (delta 2), reused 0 (delta 0), pack-reused 0
|
|
Receiving objects: 100% (18/18), done.
|
|
Resolving deltas: 100% (2/2), done.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob
|
|
$ cd project
|
|
|
|
32) Настройка Боба
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git config user.name 'Bob(AnisenkovPD)'
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git config user.email 'AnisenkovPD@mpei.ru'
|
|
|
|
33) Коммит печати произведения у Боба
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git commit -a -m 'code: печать произведения'
|
|
[main befd563] code: печать произведения
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
Проверка коммитов от имени Боба
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git log --stat
|
|
commit befd56393a02d55124df28f7b60bbe1162d2cca1 (HEAD -> main)
|
|
Author: Bob(AnisenkovPD) <AnisenkovPD@mpei.ru>
|
|
Date: Sat Mar 30 14:01:11 2024 +0300
|
|
|
|
code: печать произведения
|
|
|
|
main.cpp | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
34) Отправка коммита на сервер; Совместная работа над проектом без конфликтов правок.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git push
|
|
Enumerating objects: 5, done.
|
|
Counting objects: 100% (5/5), done.
|
|
Delta compression using up to 12 threads
|
|
Compressing objects: 100% (3/3), done.
|
|
Writing objects: 100% (3/3), 418 bytes | 418.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/AnisenkovPD/cs-lab002.git
|
|
df9e3ba..befd563 main -> main
|
|
|
|
35) Загрузка изменений на Алисе
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/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), 398 bytes | 132.00 KiB/s, done.
|
|
From http://uit.mpei.ru/git/AnisenkovPD/cs-lab002
|
|
df9e3ba..befd563 main -> origin/main
|
|
|
|
36) Просмотр истории всех веток у Алисы: ветка main отстает на один коммит от ветки origin/main
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --oneline --decorate --all --graph
|
|
* befd563 (origin/main) code: печать произведения
|
|
* df9e3ba (HEAD -> main) git: игнорирование бинарных файлов
|
|
* fbeca29 code: добавлен вывод разности
|
|
* 2462445 добавлен вывод суммы
|
|
* 279b131 code: добавлен ввод чисел
|
|
* e70eec9 build: добавлен файл проекта
|
|
* 3c52ad0 code: заготовка программы
|
|
|
|
37) Продвижение ветки main к скачанной версии
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git pull --ff-only
|
|
Updating df9e3ba..befd563
|
|
Fast-forward
|
|
main.cpp | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
38) На машине Алисы: печать деления и его коммит
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -a -m 'code: печать деления'
|
|
warning: in the working copy of 'project.cbp', LF will be replaced by CRLF the next time Git touches it
|
|
[main 6ff57a7] code: печать деления
|
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
38) Отправка коммита на сервер от Алисы
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git push
|
|
Enumerating objects: 7, done.
|
|
Counting objects: 100% (7/7), done.
|
|
Delta compression using up to 12 threads
|
|
Compressing objects: 100% (4/4), done.
|
|
Writing objects: 100% (4/4), 467 bytes | 467.00 KiB/s, done.
|
|
Total 4 (delta 2), 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/AnisenkovPD/cs-lab002.git
|
|
befd563..6ff57a7 main -> main
|
|
|
|
39)Загрузка изменений и продвижение Боба до скачанной версии:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git pull
|
|
remote: Enumerating objects: 7, done.
|
|
remote: Counting objects: 100% (7/7), done.
|
|
remote: Compressing objects: 100% (4/4), done.
|
|
remote: Total 4 (delta 2), reused 0 (delta 0), pack-reused 0
|
|
Unpacking objects: 100% (4/4), 447 bytes | 63.00 KiB/s, done.
|
|
From http://uit.mpei.ru/git/AnisenkovPD/cs-lab002
|
|
befd563..6ff57a7 main -> origin/main
|
|
Updating befd563..6ff57a7
|
|
Fast-forward
|
|
main.cpp | 3 ++-
|
|
project.cbp | 1 +
|
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
40) Вывод максимума Алисой, его коммит и загрузка на сервер
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git commit -a -m 'code: вывод максимального числа'
|
|
[main 37168cf] code: вывод максимального числа
|
|
1 file changed, 6 insertions(+)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git push
|
|
Enumerating objects: 5, done.
|
|
Counting objects: 100% (5/5), done.
|
|
Delta compression using up to 12 threads
|
|
Compressing objects: 100% (3/3), done.
|
|
Writing objects: 100% (3/3), 455 bytes | 455.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/AnisenkovPD/cs-lab002.git
|
|
6ff57a7..37168cf main -> main
|
|
|
|
41) Вывод минимума Бобом, его коммит и неудачная попытка загрузки на сервер:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git commit -a -m 'code: вывод минимального числа'
|
|
[main 62cef62] code: вывод минимального числа
|
|
1 file changed, 6 insertions(+)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git push
|
|
To http://uit.mpei.ru/git/AnisenkovPD/cs-lab002.git
|
|
! [rejected] main -> main (fetch first)
|
|
error: failed to push some refs to 'http://uit.mpei.ru/git/AnisenkovPD/cs-lab002.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.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git pull
|
|
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), 435 bytes | 87.00 KiB/s, done.
|
|
From http://uit.mpei.ru/git/AnisenkovPD/cs-lab002
|
|
6ff57a7..37168cf main -> origin/main
|
|
Auto-merging main.cpp
|
|
CONFLICT (content): Merge conflict in main.cpp
|
|
Automatic merge failed; fix conflicts and then commit the result.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main|MERGING)
|
|
$ git log --oneline --decorate --all --graph
|
|
* 62cef62 (HEAD -> main) code: вывод минимального числа
|
|
| * 37168cf (origin/main, origin/HEAD) code: вывод максимального числа
|
|
|/
|
|
* 6ff57a7 code: печать деления
|
|
* befd563 code: печать произведения
|
|
* df9e3ba git: игнорирование бинарных файлов
|
|
* fbeca29 code: добавлен вывод разности
|
|
* 2462445 добавлен вывод суммы
|
|
* 279b131 code: добавлен ввод чисел
|
|
* e70eec9 build: добавлен файл проекта
|
|
* 3c52ad0 code: заготовка программы
|
|
|
|
42. Перемещение коммита Боба поверх коммита Алисы завершилось ошибкой:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main|MERGING)
|
|
$ git rebase origin/main
|
|
main.cpp: needs merge
|
|
error: cannot rebase: You have unstaged changes.
|
|
error: additionally, your index contains uncommitted changes.
|
|
error: Please commit or stash them.
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main|MERGING)
|
|
$ git commit -a -m 'code: вывод максимума и минимума'
|
|
[main 0ca0feb] code: вывод максимума и минимума
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git rebase origin/main
|
|
Auto-merging main.cpp
|
|
CONFLICT (content): Merge conflict in main.cpp
|
|
error: could not apply 62cef62... 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".
|
|
Could not apply 62cef62... code: вывод минимального числа
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main|REBASE 1/1)
|
|
$ git add main.cpp
|
|
|
|
43. После исправления кода Боба:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main|REBASE 1/1)
|
|
$ git rebase --continue
|
|
hint: Waiting for your editor to close the file... 0 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
182725 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
1515763 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
1682467 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
1836214 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
5149809 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
5364711 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
10538503 [sig] bash 2058! sigpacket::process: Suppressing signal 18 to win32 process (pid 3144)
|
|
[detached HEAD 9f68b60] code: вывод минимального числа
|
|
1 file changed, 8 insertions(+)
|
|
Successfully rebased and updated refs/heads/main.
|
|
|
|
44. Загрузка данных на сервер Бобом:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/bob/project (main)
|
|
$ git push
|
|
Enumerating objects: 5, done.
|
|
Counting objects: 100% (5/5), done.
|
|
Delta compression using up to 12 threads
|
|
Compressing objects: 100% (3/3), done.
|
|
Writing objects: 100% (3/3), 438 bytes | 438.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/AnisenkovPD/cs-lab002.git
|
|
37168cf..9f68b60 main -> main
|
|
|
|
45. Изменение типа данных переменных у Алисы в отдельной ветке double:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git branch double (создание ветки дабл)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git checkout double (переход на ветку)
|
|
Switched to branch 'double'
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (double)
|
|
$ git commit -a -m 'code: изменение типа данных'
|
|
[double 982a65d] code: изменение типа данных
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
46. Переход в ветку main и слияние double в main:
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (double)
|
|
$ git checkout main
|
|
Switched to branch 'main'
|
|
Your branch is up to date with 'origin/main'.
|
|
|
|
47.Результат слияния
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git pull
|
|
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), 418 bytes | 38.00 KiB/s, done.
|
|
From http://uit.mpei.ru/git/AnisenkovPD/cs-lab002
|
|
37168cf..9f68b60 main -> origin/main
|
|
Updating 37168cf..9f68b60
|
|
Fast-forward
|
|
main.cpp | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git log --oneline --decorate --all --graph
|
|
* 982a65d (double) code: изменение типа данных
|
|
| * 9f68b60 (HEAD -> main, origin/main) code: вывод минимального числа
|
|
|/
|
|
* 37168cf code: вывод максимального числа
|
|
* 6ff57a7 code: печать деления
|
|
* befd563 code: печать произведения
|
|
* df9e3ba git: игнорирование бинарных файлов
|
|
* fbeca29 code: добавлен вывод разности
|
|
* 2462445 добавлен вывод суммы
|
|
* 279b131 code: добавлен ввод чисел
|
|
* e70eec9 build: добавлен файл проекта
|
|
* 3c52ad0 code: заготовка программы
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git merge double
|
|
Auto-merging main.cpp
|
|
Merge made by the 'ort' strategy.
|
|
main.cpp | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
48. Занос изменений на сервер
|
|
|
|
Professional@User-PC MINGW64 ~/Desktop/lab002/alice/project (main)
|
|
$ git push
|
|
Enumerating objects: 10, done.
|
|
Counting objects: 100% (10/10), done.
|
|
Delta compression using up to 12 threads
|
|
Compressing objects: 100% (6/6), done.
|
|
Writing objects: 100% (6/6), 743 bytes | 743.00 KiB/s, done.
|
|
Total 6 (delta 2), 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/AnisenkovPD/cs-lab002.git
|
|
9f68b60..9a83def main -> main
|