Отчет по лабораторной работе № 2 "Система контроля версий Git" Выполнила: Ильинцева Л.В. Группа: А-01-22 Проверил: Козлюк Д. А. Примечание: работа выполнялась на Windows. 1. Создала на рабочем столе каталог lab2 и запустила в нем Git Bash, приглашение: Admin@copudahter MINGW64 ~/Desktop/lab2 $ 2. Просмотрела файлы в рабочем каталоге командой "ls", каталог пустой: Admin@copudahter MINGW64 ~/Desktop/lab2 $ ls 3. Создала каталоги Алисы и Боба: Admin@copudahter MINGW64 ~/Desktop/lab2 $ mkdir alice Admin@copudahter MINGW64 ~/Desktop/lab2 $ mkdir bob 4. Изучила команду "cd" - перехода между каталогами: Admin@copudahter MINGW64 ~/Desktop/lab2 $ cd alice Admin@copudahter MINGW64 ~/Desktop/lab2/alice $ cd .. 4. Просмотрела файлы в рабочем каталоге командой "ls", в катологе созданы alice, bob: Admin@copudahter MINGW64 ~/Desktop/lab2 $ ls alice/ bob/ 5. Перешла в каолог alice, затем созала и перешла в католог project: Admin@copudahter MINGW64 ~/Desktop/lab2 $ cd alice Admin@copudahter MINGW64 ~/Desktop/lab2/alice $ mkdir project Admin@copudahter MINGW64 ~/Desktop/lab2 $ cd project 6. Инициализировала репозиторий в катологе project: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project $ git init Initialized empty Git repository in C:/Users/Admin/Desktop/lab2/alice/project/.git/ 7. Изменила название текущей ветки Git c master на main: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (master) $ git branch -m master main 8. Настроила данные пользователя репозитория в катологе alice: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git config user.name 'alice (IlintsevaLV)' Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git config user.email 'IlintsevaLV@mpei.ru' 9.Запустила CodeBlocks и создала проект в репозитарии Алисы и создала файлы main.cpp и project.cbp: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ ls main.cpp project.cbp 10. Просмотрела состояние рабочей копии командой "git status": Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git status On branch main (ветка main) No commits yet (пока нет коммитов) Untracked files: (неотслеживаемые файлы) (use "git add ..." to include in what will be committed) (подсказка для создания коммитов) main.cpp project.cbp nothing added to commit but untracked files present (use "git add" to track) (ничего не добавленно в коммит, но есть неотслеживаемые файлы + подсказка) 11. Дбавила файл main.cpp в индекс - набор изменений в будущем коммите: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git add main.cpp 12. Просмотрела состояние рабочей копии командой "git status", : Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git status On branch main No commits yet Changes to be committed: (изменения, кооторые будут добавлены в коммит) (use "git rm --cached ..." to unstage) new file: main.cpp Untracked files: (неотслеживаемые файлы) (use "git add ..." to include in what will be committed) project.cbp Файл main.cpp перестал быть неотслеживаемым файлом, добавлен в список изменений будущего коммита. 13. Создание коммита: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git commit -m 'code: заготовка программы' [main (root-commit) c810231] code: заготовка программы 1 file changed, 9 insertions(+) create mode 100644 main.cpp 14. Файл project.cbp добавила в индекс, а затем создала с ним нвый коммит: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git add project.cbp Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git commit -m 'build: add project file' [main aa39f36] build: add project file 1 file changed, 40 insertions(+) create mode 100644 project.cbp 15. Просмотрела состояние рабочей копии до изменения файла main.cpp и после: До: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git status On branch main nothing to commit, working tree clean (на главной ветке нет неотслеживаемых файлов, нечего добавить в коммит) После: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git status On branch main Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: main.cpp Untracked files: (use "git add ..." to include in what will be committed) bin/ obj/ project.layout no changes added to commit (use "git add" and/or "git commit -a") (изменения в файле не подготовлены для добавления в коммит, подсказка как добавить изменения в индекс + подсказка как убрать изменения в файле, после изменения файла min.cpp появились новые неотслеживаемые файлы) 16.Выбрала файлы, изменения (добавила вывод суммы и разности a и b) которых должны войти в коммит, затем сделала коммит: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: вывод суммы' [main c00075f] code: вывод суммы 1 file changed, 5 insertions(+), 1 deletion(-) Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: вывод разности' [main 63244cc] code: вывод разности 1 file changed, 3 insertions(+), 1 deletion(-) 17. Заметим, что при сборке программы появились дополнительные неотслеживаемые файлы: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git status On branch main Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: main.cpp Untracked files: (use "git add ..." to include in what will be committed) bin/ obj/ project.layout no changes added to commit (use "git add" and/or "git commit -a") 18. Создала в CodeBlocks файл .gitignore, добавила в него команды для игнорирования ненужных файлов и катологов. Применила git status, игнорируемые файлы не отображаются: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git status On branch main Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: main.cpp modified: project.cbp Untracked files: (use "git add ..." to include in what will be committed) .gitignore no changes added to commit (use "git add" and/or "git commit -a") 19. Создала коммит с .gitignore: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git add .gitignore Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git commit -m 'git: ignore 3 files' [main 30320b8] git: ignore 3 files 1 file changed, 3 insertions(+) create mode 100644 .gitignore 20. Просмотрела истроию репозитория: Применила команду git log Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git log commit 30320b80d8e82aef6230a196073c9123b9db46fe (HEAD -> main) Author: alice (IlintsevaLV) Date: Mon Mar 13 10:54:35 2023 +0300 git: ignore 3 files commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:38:42 2023 +0300 code: вывод разности commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: вывод суммы commit aa39f36e12a464b0d63360ce65623ecaafceb949 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:20:44 2023 +0300 build: add project file commit c8102313959d8c83a5a1c8c46953e68c52682ba9 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:09:52 2023 +0300 code: заготовка программы 21. Просмотрела историю репозитория, применила команду git log --oneline --decorate: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate 9b7505c git: ignore 3 files 63244cc code: вывод разности c00075f code: вывод суммы d284db2 build: add project file 762a185 code: заготовка программы 22. Просмотрела историю репозитория, применила команду git log --oneline --decorate --all --graph: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git log --oneline --decorate --all --graph * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы 23. Просмотрела историю репозитория, применила команду git log --oneline --decorate git log --stat, для последнего коммита указано, что был изменен один файл, в него добавили три строки - игнорирование трех файлов: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git log --stat commit 30320b80d8e82aef6230a196073c9123b9db46fe (HEAD -> main) Author: alice (IlintsevaLV) Date: Mon Mar 13 10:54:35 2023 +0300 git: ignore 3 files .gitignore | 3 +++ 1 file changed, 3 insertions(+) commit f91e880ba8f124b920300cd8abb56b888d678bf4 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:48:38 2023 +0300 code: добавлен вывод разности a и b в программу main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit f91e880ba8f124b920300cd8abb56b888d678bf4 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: добавлен вывод суммы a и b в программу main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit aa39f36e12a464b0d63360ce65623ecaafceb949 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:20:44 2023 +0300 build: add project file project.cbp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 24. Просмотрела коммиты, затрагивающие файл project.cbp: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git log -- project.cbp commit aa39f36e12a464b0d63360ce65623ecaafceb949 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:20:44 2023 +0300 build: add project file 25. Просмотрела коммиты по теме build: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git log --grep 'build:' commit aa39f36e12a464b0d63360ce65623ecaafceb949 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:20:44 2023 +0300 build: add project file 26. Просмотрела предпоследний коммит тремя способами: (1) Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git show main~1 commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: добавлен вывод разности a,b diff --git a/main.cpp b/main.cpp index b4392ec..ad321f2 100644 --- a/main.cpp +++ b/main.cpp @@ -4,6 +4,7 @@ using namespace std; int main() { - cout << "Hello world!" << endl; - return 0; + cout << "Enter A and B: "; + int a,b; + cin >> a >>b; } (2) Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git show HEAD~1 commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: добавлен вывод разности a,b diff --git a/main.cpp b/main.cpp index b4392ec..ad321f2 100644 --- a/main.cpp +++ b/main.cpp @@ -4,6 +4,7 @@ using namespace std; int main() { - cout << "Hello world!" << endl; - return 0; + cout << "Enter A and B: "; + int a,b; + cin >> a >>b; } (3) Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git show 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: добавлен вывод разности a,b diff --git a/main.cpp b/main.cpp index b4392ec..ad321f2 100644 --- a/main.cpp +++ b/main.cpp @@ -4,6 +4,7 @@ using namespace std; int main() { - cout << "Hello world!" << endl; - return 0; + cout << "Enter A and B: "; + int a,b; + cin >> a >>b; } 27. Внесла изменения в файл main.cpp, но не создавала коммит. Просмотрела изменения в рабочей копии: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git diff warning: in the working copy of 'project.cbp', LF will be replaced by CRLF the next time Git touches it (предупреждение, что рабочая копия будеть изменена при следующем взаимодействии с Git) diff --git a/main.cpp b/main.cpp index ad321f2..41b8e22 100644 --- a/main.cpp +++ b/main.cpp @@ -7,4 +7,7 @@ int main() cout << "Enter A and B: "; int a,b; cin >> a >>b; + cout << "A + B = " << a + b << '\n' + << "A - B = " << a - b << '\n' + << "A * B = " << a * b << '\n' } diff --git a/project.cbp b/project.cbp (входные данные команды для сравнения файлов) index 99bb702..6f3f5a9 100644 --- a/project.cbp +++ b/project.cbp (заголовок с историей изменения, место кода и изменения функций) @@ -32,6 +32,10 @@ + + + (строки вокруг измененной части, удаленные и добавленные строки) 28. Просмотрела изменения между самым первым коммитом и коммитом, добавляющим вывод разности: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git diff HEAD~3 HEAD~1 diff --git a/main.cpp b/main.cpp index b4392ec..eae9f61 100644 --- a/main.cpp +++ b/main.cpp @@ -4,6 +4,9 @@ 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' + << "A - B = " << a - b << '\n'; } 29. Создала коммит изменения в рабочей копии - вывод произведения: dmin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git commit -m 'code: произведение' [main 8c9d382] code: произведение 1 file changed, 3 insertions(+) 30. Отменила только что созданный коммит и вернулась к предыдущему: Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git reset --hard HEAD~1 HEAD is now at 30320b8 git: ignore 3 files 31. Добавила в файле main.cpp коментарий, затем убрала его с помощью "git checkout": Admin@copudahter MINGW64 ~/Desktop/lab2/alice/project (main) $ git checkout HEAD -- main.cpp 32. Создала пару ключей: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/Admin/.ssh/id_rsa): /c/Users/Admin/.ssh/id_rsa already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/Admin/.ssh/id_rsa Your public key has been saved in /c/Users/Admin/.ssh/id_rsa.pub The key fingerprint is: SHA256:qqW6CJKdMLEWEnLSiuSccZKvjsCgSxJGDAesx9zzrsI Admin@copudahter The key's randomart image is: +---[RSA 3072]----+ |Xo+ | |.&.. | |X=*. | |BB=.o | |O+. o S | |=O . .. | |Xoo .o | |=oE +. | |. o++. | +----[SHA256]-----+ 33. Запустила агент, загрузила ключ: $ eval $(ssh-agent -s) Agent pid 1623 Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ ssh-add Enter passphrase for /c/Users/Admin/.ssh/id_rsa: Identity added: /c/Users/Admin/.ssh/id_rsa (Admin@copudahter) 34. Отправила проект на сервер, изменила тип подключения с ssh на https: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git remote add origin git@uit.mpei.ru:IlintsevaLV/cs-lab02.git Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git push -u origin main The authenticity of host 'uit.mpei.ru (193.233.68.149)' can't be established. ED25519 key fingerprint is SHA256:Q5w0UKEzQKA3J6NyMtjwCLvtAykoxdugIXjx6NwU4NA. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'uit.mpei.ru' (ED25519) to the list of known hosts. Enumerating objects: 15, done. Counting objects: 100% (15/15), done. Delta compression using up to 12 threads Compressing objects: 100% (13/13), done. Writing objects: 100% (15/15), 1.96 KiB | 501.00 KiB/s, done. Total 15 (delta 1), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To uit.mpei.ru:IlintsevaLV/cs-lab02.git * [new branch] main -> main branch 'main' set up to track 'origin/main'. 35. Клонировала проект в католог Bob: Admin@copudahter MINGW64 ~/Desktop/lab02/bob (main) $ git clone http://uit.mpei.ru/git/IlintsevaLV/cs-lab02.git project Cloning into 'project'... remote: Enumerating objects: 12, done. remote: Counting objects: 100% (12/12), done. remote: Compressing objects: 100% (10/10), done. remote: Total 12 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (12/12), done. 36. Настроила данные пользоваетля в катологе Bob: Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git config user.name 'bob (IlintsevaLV)' Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git config user.email 'IlintsevaLV@mpei.ru' 37. Создала коммит с изменением файла main.cpp в катологе Bob: Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git commit -m 'code: добавлено произведение чисел a,b' [main b47b6f5] code: добавлено произведение чисел a,b 1 file changed, 1 insertion(+) 38. Просмотрела историю коммитов, убедилась, что последний коммит сделан от имени Боба: Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git log commit b47b6f5fee1bb3e5b7a0e299e85e0117aca9eede (HEAD -> main) Author: bob (IlintsevaLV) Date: Sun Mar 26 20:27:40 2023 +0300 code: добавлено произведение чисел a,b commit 30320b80d8e82aef6230a196073c9123b9db46fe (origin/main, origin/HEAD) Author: alice (IlintsevaLV) Date: Mon Mar 13 10:54:35 2023 +0300 git: ignore 3 files commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 commit f91e880ba8f124b920300cd8abb56b888d678bf4 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:48:38 2023 +0300 code: добавлен вывод разности a и b в программу main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit f91e880ba8f124b920300cd8abb56b888d678bf4 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: добавлен вывод суммы a и b в программу main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) build: add project file 39. Отправила новый коммит на сервер: Admin@copudahter MINGW64 ~/Desktop/lab02/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), 414 bytes | 207.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To http://uit.mpei.ru/git/IlintsevaLV/cs-lab02.git 30320b8..b47b6f5 main -> main 40. В катологе alice выполнила загрузку изменений: Admin@copudahter 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), 394 bytes | 24.00 KiB/s, done. From http://uit.mpei.ru/git/IlintsevaLV/cs-lab02 30320b8..b47b6f5 main -> origin/main 41. Подвинула ветку main к скаченной верссии: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git pull --ff-only Updating 30320b8..b47b6f5 Fast-forward main.cpp | 1 + 1 file changed, 1 insertion(+) 42. Сравнила рабочии копии катологов алисы и боба: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * b47b6f5 (HEAD -> main, origin/main) code: добавлено произведение чисел a,b * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git log --oneline --decorate --all --graph * b47b6f5 (HEAD -> main, origin/main, origin/HEAD) code: добавлено произведение чисел a,b * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы 43.«От имени Алисы» добавила в программу печать деления, сделала коммит, отправила его на сервер и получила новую версию «на машине Боба»: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: добавлен вывод деления' [main 9050bac] code: добавлен вывод деления 1 file changed, 2 insertions(+), 1 deletion(-) Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git log commit 9050bacd220e27fea9be06aadd1f847bdb4bae0d (HEAD -> main) Author: alice (IlintsevaLV) Date: Sun Mar 26 20:44:55 2023 +0300 code: добавлен вывод деления commit b47b6f5fee1bb3e5b7a0e299e85e0117aca9eede (origin/main) Author: bob (IlintsevaLV) Date: Sun Mar 26 20:27:40 2023 +0300 code: добавлено произведение чисел a,b commit 30320b80d8e82aef6230a196073c9123b9db46fe Author: alice (IlintsevaLV) Date: Mon Mar 13 10:54:35 2023 +0300 git: ignore 3 files commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 code: added code to file Admin@copudahter MINGW64 ~/Desktop/lab02/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), 419 bytes | 209.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To http://uit.mpei.ru/git/IlintsevaLV/cs-lab02.git b47b6f5..9050bac main -> main Admin@copudahter MINGW64 ~/Desktop/lab02/bob/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), 399 bytes | 23.00 KiB/s, done. From http://uit.mpei.ru/git/IlintsevaLV/cs-lab02 b47b6f5..9050bac main -> origin/main Updating b47b6f5..9050bac Fast-forward main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git log commit 9050bacd220e27fea9be06aadd1f847bdb4bae0d (HEAD -> main, origin/main, origin/HEAD) Author: alice (IlintsevaLV) Date: Sun Mar 26 20:44:55 2023 +0300 code: добавлен вывод деления commit b47b6f5fee1bb3e5b7a0e299e85e0117aca9eede Author: bob (IlintsevaLV) Date: Sun Mar 26 20:27:40 2023 +0300 code: добавлено произведение чисел a,b commit 30320b80d8e82aef6230a196073c9123b9db46fe Author: alice (IlintsevaLV) Date: Mon Mar 13 10:54:35 2023 +0300 git: ignore 3 files commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git log commit 9050bacd220e27fea9be06aadd1f847bdb4bae0d (HEAD -> main, origin/main) Author: alice (IlintsevaLV) Date: Sun Mar 26 20:44:55 2023 +0300 code: добавлен вывод деления commit b47b6f5fee1bb3e5b7a0e299e85e0117aca9eede Author: bob (IlintsevaLV) Date: Sun Mar 26 20:27:40 2023 +0300 code: добавлено произведение чисел a,b commit 30320b80d8e82aef6230a196073c9123b9db46fe Author: alice (IlintsevaLV) Date: Mon Mar 13 10:54:35 2023 +0300 git: ignore 3 files commit 97d1af9b7ea9fd1a7ea36cd4eec0ea0b23fe49f0 Author: alice (IlintsevaLV) Date: Mon Mar 13 10:36:38 2023 +0300 44. В катологе алисы добавила вывод максимума, создала коммит с изменением и отправила его на сервер: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: вывод максимума' [main 22508b9] code: вывод максимума 1 file changed, 2 insertions(+), 1 deletion(-) Admin@copudahter MINGW64 ~/Desktop/lab02/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), 416 bytes | 416.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To http://uit.mpei.ru/git/IlintsevaLV/cs-lab02.git f1b3462..22508b9 main -> main 45. В катологе боба добавила вывод минимума, создала коммит, отправка на сервер не выполнена, т.к. коммит боба основан не на последнем коммите: Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git commit -m 'code: вывод минимума' [main 05b7ec4] code: вывод минимума 1 file changed, 2 insertions(+), 1 deletion(-) Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git push To http://uit.mpei.ru/git/IlintsevaLV/cs-lab02.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'http://uit.mpei.ru/git/IlintsevaLV/cs-lab02.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. 46. история всех веток, после загрузки коммитов из хранилища: $ 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), 413 bytes | 51.00 KiB/s, done. From uit.mpei.ru:IlintsevaLV/cs-lab02 02bf424..1ab1c07 main -> origin/main (ветка main раздвоилась) Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git log --oneline --decorate --all --graph * 450c262 (HEAD -> main) code: вывод минимума | * 1ab1c07 (origin/main, origin/HEAD) code: вывод максимума |/ * 02bf424 code: добавлен вывод деления * e66b2ee code: добавлено произведение чисел a,b * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы (Объединила коммиты Боба и Алисы, поместив коммит Боба выше с помощью комманды git rebase) Admin@copudahter 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 450c262... code: вывод минимума hint: Resolve all conflicts manually, mark them as resolved with hint: "git add/rm ", 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 450c262... code: вывод минимума (Комманда завершается с ошибкой из-за конфликта в файле с кодом main.cpp. Производный файл от файла Алисы и Боба записывается в рабочую копию с помеченными метками конфликта. Убрала метки конфликта, и доработала код так, чтобы программа компилировалась и работала. Затем загрузила изменения в индекс и продолжила операцию git rebase, с помощью флага –continue. ) Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main|REBASE 1/1) $ git add main.cpp Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main|REBASE 1/1) $ git rebase --continue [detached HEAD 31bb9ba] code: вывод минимума 1 file changed, 2 insertions(+), 1 deletion(-) Successfully rebased and updated refs/heads/main. Admin@copudahter MINGW64 ~/Desktop/lab02/bob/project (main) $ git log --oneline --decorate --all --graph * 31bb9ba (HEAD -> main) code: вывод минимума * 1ab1c07 (origin/main, origin/HEAD) code: вывод максимума * 02bf424 code: добавлен вывод деления * e66b2ee code: добавлено произведение чисел a,b * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы 47. Отправила изменения на сервер Admin@copudahter MINGW64 ~/Desktop/lab02/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), 441 bytes | 441.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To uit.mpei.ru:IlintsevaLV/cs-lab02.git 1ab1c07..31bb9ba main -> main 48. на машине алисы создала новую ветку double: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git branch double Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git checkout double Switched to branch 'double' Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (double) $ git checkout main Switched to branch 'main' M main.cpp Your branch is up to date with 'origin/main'. 49. Создала коммит с изменениями в файле main.cpp на ветке double: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (double) $ git add -u Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (double) $ git commit -m 'code: изменен тип пременных' [double da37261] code: изменен тип пременных 1 file changed, 1 insertion(+), 1 deletion(-) 50. переключилась на ветку main. И синхронизировала её: Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (double) $ git checkout main Switched to branch 'main' Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded. (use "git pull" to update your local branch) Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git pull Updating 1ab1c07..31bb9ba Fast-forward main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * da37261 (double) code: изменен тип пременных | * 31bb9ba (HEAD -> main, origin/main) code: вывод минимума |/ * 1ab1c07 code: вывод максимума * 02bf424 code: добавлен вывод деления * e66b2ee code: добавлено произведение чисел a,b * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы 51. Получила одновременно две ветки. Объединила их с помощью комманды git merge. Внесла последние изменения и загрузила на GitHub: Admin@copudahter MINGW64 ~/Desktop/lab02/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(-) Admin@copudahter MINGW64 ~/Desktop/lab02/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), 753 bytes | 753.00 KiB/s, done. Total 6 (delta 2), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To uit.mpei.ru:IlintsevaLV/cs-lab02.git 31bb9ba..419d080 main -> main Admin@copudahter MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * 419d080 (HEAD -> main, origin/main) Merge branch 'double' |\ | * da37261 (double) code: изменен тип пременных * | 31bb9ba code: вывод минимума |/ * 1ab1c07 code: вывод максимума * 02bf424 code: добавлен вывод деления * e66b2ee code: добавлено произведение чисел a,b * 9b7505c git: ignore 3 files * 63244cc code: вывод разности * c00075f code: вывод суммы * d284db2 build: add project file * 762a185 code: заготовка программы