From c4d3f3e74965e8d699e9a4846912e00f3da3d650 Mon Sep 17 00:00:00 2001 From: MachulinaDV Date: Mon, 27 Mar 2023 14:01:47 +0300 Subject: [PATCH] new: report --- README.txt | 689 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 689 insertions(+) create mode 100644 README.txt diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..889748b --- /dev/null +++ b/README.txt @@ -0,0 +1,689 @@ +Отчет по лабораторной работе № 2 "Система контроля версий Git" + +Выполнил: Мачулина Д. В. +Группа: А-02-22 +Проверил: Козлюк Д. А. + +Примечание: работа выполнялась на Windows. + +Ход работы: +1. Создание на рабочем столе каталог lab02 и запустил в нем Git Bash, приглашение: +daria@mypc MINGW64 ~/Desktop/lab-02 +$ + +2. Просмотр файлов в рабочем каталоге командой ls: +daria@mypc MINGW64 ~/Desktop/lab-02 +$ +Так как в каталоге пусто, в консоли не отображается никакого результата. + +3. Создание папок alice и bob – имитация компьютеров двух пользователей: +daria@mypc MINGW64 ~/Desktop/lab-02 +$ mkdir alice + +daria@mypc MINGW64 ~/Desktop/lab-02 +$ mkdir bob + +4. Команда cd: +4.1 Переход в папку Алисы: +daria@mypc MINGW64 ~/Desktop/lab-02 +$ cd alice + +daria@mypc MINGW64 ~/Desktop/lab-02/alice + +Возвращение на уровень выше с помощью команды cd ..: +daria@mypc MINGW64 ~/Desktop/lab-02/alice +$ cd .. + +daria@mypc MINGW64 ~/Desktop/lab-02 +$ + +Переход в папку Боба: +daria@mypc MINGW64 ~/Desktop/lab-02 +$ cd bob + +И возвращение обратно в папку Алисы: +daria@mypc MINGW64 ~/Desktop/lab-02/bob +$ cd .. + +daria@mypc MINGW64 ~/Desktop/lab-02 +$ cd alice + +daria@mypc MINGW64 ~/Desktop/lab-02/alice +$ + +4.2 Создание каталога project и переход в него: +daria@mypc MINGW64 ~/Desktop/lab-02/alice +$ mkdir project + +daria@mypc MINGW64 ~/Desktop/lab-02/alice +$ cd project + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project +$ + +4.3 Переход из папки project в папку Алисы и обратно: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project +$ cd .. + +daria @mypc MINGW64 ~/Desktop/lab-02/alice +$ cd project + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project +$ + +5. Инициализация репозитория: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project +$ git init +Initialized empty Git repository in C:/Users/user/Desktop/lab-02/alice/project/.git/ + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ + +Так как используется старая версия Git, имя будет изменено позднее. + +6. Настройка репозитария Алисы: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git config user.name 'Alice (MachulinaDV)' + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git config user.email 'MachulinaDV@mpei.ru' + +7. Проверка состояния рабочей копии: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git status +On branch master – расположение копии (ветка) + +No commits yet – количество коммитов. + +Untracked files: + (use "git add ..." to include in what will be committed) + .vs/ + Project.sln + Project.vcxproj + Project.vcxproj.filters + Project.vcxproj.user + Source.cpp +Файлы в репозитории. Их состояния (отслеживаются или нет. В данном случае – нет) +nothing added to commit but untracked files present (use "git add" to track) – сообщение о присутствии неотслеживаемых файлов в ветке. + +8. Отслеживаение файла Source.cpp: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git add Source.cpp + +8.1 Изменения в репозитории: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git status +On branch master +No commits yet +Changes to be committed: + (use "git rm --cached ..." to unstage) + new file: Source.cpp + +Untracked files: + (use "git add ..." to include in what will be committed) + .vs/ + Project.sln + Project.vcxproj + Project.vcxproj.filters + Project.vcxproj.user + +9. Создание коммита: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git commit -m 'code: заготовка программы' +[master (root-commit) 670da6a] code: заготовка программы + 1 file changed, 0 insertions(+), 0 deletions(-) + create mode 100644 Source.cpp + +10. Изменение имени ветки +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (master) +$ git branch -m main + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ + +11. Создание коммита для сборки проекта: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git add Project.sln + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git commit -m 'build: добавление файла проекта' +[main e96354f] build: добавление файла проекта + 1 file changed, 31 insertions(+) + create mode 100644 Project.sln + +12. Изменение файла, занесённого под Git: +daria@mypc MINGW64 ~/Desktop/lab-02/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: Source.cpp + +Untracked files: + (use "git add ..." to include in what will be committed) + .vs/ + Project.vcxproj + Project.vcxproj.filters + Project.vcxproj.user + +no changes added to commit (use "git add" and/or "git commit -a") +В данном случае Git отмечает, что в отслеживаемом файле произошли изменения, но они не были занесены в коммит. В случае с созданием файла, когда он находится в секции “Changes to be committed” – изменения (здесь – создание файла) проиндексированы и сохранены. + +13. Добавление суммы: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git add Source.cpp + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git commit -m "calc: сумма" +[main e725e82] calc: сумма + 1 file changed, 14 insertions(+) + +14. Добавление разности: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git add Source.cpp + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git commit -m "calc: разность" +[main a0abd05] calc: разность + 1 file changed, 1 insertion(+), 1 deletion(-) + +15. Добавление игнорируемых файлов: +Текст файла .gitignore, сохранённого в корне репозитария: +/Project.vcxproj +/Project.vcxproj.filters +/Project.vcxproj.user + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git add .gitignore + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git commit -m "git: игнорирование файлов" +[main f1c32c5] git: игнорирование файлов + 1 file changed, 3 insertions(+) + create mode 100644 .gitignore + +16. Просмотр журнала репозитария: +Коммит по теме build: +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git log --grep "build" +commit e96354fae06b02e9072ae59508ef76231ce556c4 +Author: Alice (MachulinaDV) +Date: Thu Mar 23 20:43:35 2023 +0300 + + build: добавление файла проекта + +Коммиты, затрагивающие Source.cpp: +Дарья@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git log -- Source.cpp +commit a0abd05489fc4889488791ec1e1efbc24838a4a7 +Author: Alice (MachulinaDV) +Date: Thu Mar 23 21:12:20 2023 +0300 + + calc: разность + +commit e725e82a15a28b733ec40e503a5c4e8d3047e300 +Author: Alice (MachulinaDV) +Date: Thu Mar 23 21:10:06 2023 +0300 + + calc: сумма + +commit 670da6a7a11201596bd3761ef6369469e5741113 +Author: Alice (MachulinaDV) +Date: Thu Mar 23 20:38:56 2023 +0300 + + code: заготовка программы + +17. Просмотр предпоследнего коммита: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git show e725e +commit e725e82a15a28b733ec40e503a5c4e8d3047e300 +Author: Alice (MachulinaDV) +Date: Thu Mar 23 21:10:06 2023 +0300 + + calc: сумма + +diff --git a/Source.cpp b/Source.cpp +index e69de29..c1f7c80 100644 +--- a/Source.cpp ++++ b/Source.cpp +@@ -0,0 +1,14 @@ ++#include ++#include ++ ++using namespace std; ++ ++int main() ++{ ++ ++ cout << "Enter A and B: "; ++ int a, b; ++ cin >> a >> b; ++ ++ cout << "A + B = " << a + b << '\n'; ++} +\ No newline at end of file + +18. Просмотр изменений: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git diff +diff --git a/Source.cpp b/Source.cpp – две версии одного файла. A – старая, B – новая. +index 928c845..3492c90 100644 – мета-данные файла. Два первых числа — хеши двух сравниваемых файлов. 100644 — внутренний идентификатор режима файла. +--- a/Source.cpp ++++ b/Source.cpp – Git приписал знак минус (-) версии A и знак плюс (+) версии B. +@@ -10,5 +10,5 @@ int main() – из версии A извлечено 10 строк, начиная со строки 5. Из версии B извлечено 10 строк, начиная со строки 5. + int a, b; + cin >> a >> b; + +- cout << "A + B = " << a + b << '\n' << "A - B = " << a - b << '\n'; ++ cout << "A + B = " << a + b << '\n' << "A - B = " << a - b << '\n' << "A * B = " << a * b << '\n'; + } – код до и после имзменений +\ No newline at end of file – нет строк полсе изменённых. + +19. Сравнение коммитов +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git diff HEAD~4 HEAD~2 +diff --git a/Project.sln b/Project.sln +new file mode 100644 +index 0000000..61dbbd5 +--- /dev/null ++++ b/Project.sln +@@ -0,0 +1,31 @@ ++ ++Microsoft Visual Studio Solution File, Format Version 12.00 ++# Visual Studio 15 ++VisualStudioVersion = 15.0.28307.1758 ++MinimumVisualStudioVersion = 10.0.40219.1 ++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project", "Project.vcxproj", "{DEB389E9-FDD2-4194-9708-1DE969B756D9}" ++EndProject ++Global ++ GlobalSection(SolutionConfigurationPlatforms) = preSolution ++ Debug|x64 = Debug|x64 ++ Debug|x86 = Debug|x86 ++ Release|x64 = Release|x64 ++ Release|x86 = Release|x86 ++ EndGlobalSection ++ GlobalSection(ProjectConfigurationPlatforms) = postSolution ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Debug|x64.ActiveCfg = Debug|x64 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Debug|x64.Build.0 = Debug|x64 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Debug|x86.ActiveCfg = Deb ug|Win32 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Debug|x86.Build.0 = Debug|Win32 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Release|x64.ActiveCfg = Release|x64 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Release|x64.Build.0 = Release|x64 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Release|x86.ActiveCfg = Release|Win32 ++ {DEB389E9-FDD2-4194-9708-1DE969B756D9}.Release|x86.Build.0 = Release|Win32 ++ EndGlobalSection ++ GlobalSection(SolutionProperties) = preSolution ++ HideSolutionNode = FALSE ++ EndGlobalSection ++ GlobalSection(ExtensibilityGlobals) = postSolution ++ SolutionGuid = {FD124965-C430-4504-B52A-63389D0FE854} ++ EndGlobalSection ++EndGlobal +diff --git a/Source.cpp b/Source.cpp +index e69de29..c1f7c80 100644 +--- a/Source.cpp ++++ b/Source.cpp +@@ -0,0 +1,14 @@ ++#include ++#include ++ ++using namespace std; ++ ++int main() ++{ ++ ++ cout << "Enter A and B: "; ++ int a, b; ++ cin >> a >> b; ++ ++ cout << "A + B = " << a + b << '\n'; ++} +\ No newline at end of file + + +20. Добавление произведения: + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git add Source.cpp + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git commit -m "calc: произведение" +[main 3df47c0] calc: произведение + 1 file changed, 1 insertion(+), 1 deletion(-) + +21. Откат изменений: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git reset --hard HEAD~1 +HEAD is now at f1c32c5 git: игнорирование файлов + +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ git checkout HEAD -- Source.cpp + +22. Генерация аутентификационного ключа: +Дарья@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ ssh-keygen +Generating public/private rsa key pair. +Enter file in which to save the key (/c/Users/user/.ssh/id_rsa): +Created directory '/c/Users/user/.ssh'. +Enter passphrase (empty for no passphrase): +Enter same passphrase again: +Your identification has been saved in /c/Users/user/.ssh/id_rsa +Your public key has been saved in /c/Users/user/.ssh/id_rsa.pub +The key fingerprint is: +SHA256:Sf0qHFwKcqMXF0K6sugQ3mKxeBLvM7xgxXKaMR72K+M Дарья@mypc +The key's randomart image is: ++---[RSA 3072]----+ +| .o . | +| . . o | +| o = o o | +| . = B + . | +|oB.+o . S . | +|==#o . . . . | +|*@+o o . | +|=B= . . | +|.E== | ++----[SHA256]-----+ + +23. Загрузка ключа в агент: +daria@mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ eval $(ssh-agent -s) +Agent pid 514 + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ ssh-add +Enter passphrase for /c/Users/user/.ssh/id_rsa: +Identity added: /c/Users/user/.ssh/id_rsa (Дарья@mypc) + +daria @mypc MINGW64 ~/Desktop/lab-02/alice/project (main) +$ cat ~/.ssh/id_rsa.pub +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDfj0TCEBSDLuAAEBRjPTxwzBkdCIndaI3IACr6wQ8DB3FozGCX7tBpMdgddXs1a0EnAi1QLn4JErqCYN9wp8ecxopdUjX2RczCKJ72YrAhRBxgP7/TgFiOeqCM7qH6nEJt9JZjEK0CAQeb39yTADf93Sd+ycwnKjri9caYG3isQiwA2kOhbN0olQJUL/ylG1nWZ9QFdqYI2D92iEKpGBBOgoDWaJ4saE+Jh23BOakbu84eJlp6d09SQECfa4PofmJpu0ErInHts79IXjEdiat0kQyeJNAAZo1+tQkirQAk/65gkeAYsPb2TVuP+e7wlYBRhXPEXNkZ5ZQAlsr5dMm2OxFnxqn7oZLbFWXJD3HA8KU+i9QGyu718OIGfdkuDkTfHOyCnBmKHpMBe5pp3CshSpI6TPHnkvMUMz18xlMzZiz+8LYRZEIJi6VJULgPFkvNjVZx9GVUdOMydHLkYIjnfIU43TSk9IWRpO/7tHvydh/d/XQUfpBqagnbxuUoJiU= daria @mypc + +24. Загрузка репозитория на сервер: +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git remote add origin git@uit.mpei.ru:MachulinaDV/cs-lab02.git + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git push -u origin main +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +Enumerating objects: 18, done. +Counting objects: 100% (18/18), done. +Delta compression using up to 4 threads +Compressing objects: 100% (16/16), done. +Writing objects: 100% (18/18), 2.25 KiB | 576.00 KiB/s, done. +Total 18 (delta 3), reused 0 (delta 0), pack-reused 0 +remote: . Processing 1 references +remote: Processed 1 references in total +To uit.mpei.ru:MachulinaDV/cs-lab02.git + * [new branch] main -> main +branch 'main' set up to track 'origin/main'. + +25. Получение проекта с сервера: +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git remote -v +origin git@uit.mpei.ru:MachulinaDV/cs-lab02.git (fetch) +origin git@uit.mpei.ru:MachulinaDV/cs-lab02.git (push) + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob +$ git clone git@uit.mpei.ru:MachulinaDV/cs-lab02.git project +Cloning into 'project'... +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +remote: Enumerating objects: 18, done. +remote: Counting objects: 100% (18/18), done. +remote: Compressing objects: 100% (16/16), done. +remote: Total 18 (delta 3), reused 0 (delta 0), pack-reused 0 +Receiving objects: 100% (18/18), done. +Resolving deltas: 100% (3/3), done. + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob +$ cd project + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ + + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git config user.name 'Bob (MachulinaDV)' + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git config user.email 'MachulinaDV@mpei.com' + + +26. Совместная работа над проектом: +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git add Source.cpp + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git commit -m "calc: +произведение" +[main 287808c] calc: +произведение + 1 file changed, 1 insertion(+), 1 deletion(-) + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git log +commit 287808cdcad9214cfc3cfdd435237b98528ef304 (HEAD -> main) +Author: Bob (MachulinaDV) +Date: Fri Mar 24 00:13:26 2023 +0300 + + calc: +произведение + +(…) + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git push +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +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), 316 bytes | 316.00 KiB/s, done. +Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 +remote: . Processing 1 references +remote: Processed 1 references in total +To uit.mpei.ru:MachulinaDV/cs-lab02.git + 47568ca..287808c main -> main + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git fetch +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +remote: Enumerating objects: 5, done. +remote: Counting objects: 100% (5/5), done. +remote: Compressing objects: 100% (3/3), done. +remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 +Unpacking objects: 100% (3/3), 296 bytes | 17.00 KiB/s, done. +From uit.mpei.ru:MachulinaDV/cs-lab02 + 47568ca..287808c main -> origin/main + + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git pull --ff-only +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +Updating 47568ca..287808c +Fast-forward + Source.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + + +Самостоятельное: + +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git add Source.cpp + +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git commit -m "calc: деление" +[main a89ab56] calc: деление + 1 file changed, 1 insertion(+), 1 deletion(-) + +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git push +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +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), 328 bytes | 328.00 KiB/s, done. +Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 +remote: . Processing 1 references +remote: Processed 1 references in total +To uit.mpei.ru:MachulinaDV/cs-lab02.git + 287808c..a89ab56 main -> main + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git fetch +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +remote: Enumerating objects: 5, done. +remote: Counting objects: 100% (5/5), done. +remote: Compressing objects: 100% (3/3), done. +remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 +Unpacking objects: 100% (3/3), 308 bytes | 17.00 KiB/s, done. +From uit.mpei.ru:MachulinaDV/cs-lab02 + 287808c..a89ab56 main -> origin/main + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git pull --ff-only +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +Updating 287808c..a89ab56 +Fast-forward + Source.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + +27. Разрешение конфликтов: +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git add Source.cpp + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git commit -m "search: максимум" +[main 6ff1d1d] search: максимум + 1 file changed, 5 insertions(+), 2 deletions(-) + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git push +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +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), 355 bytes | 355.00 KiB/s, done. +Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 +remote: . Processing 1 references +remote: Processed 1 references in total +To uit.mpei.ru:MachulinaDV/cs-lab02.git + a89ab56..6ff1d1d main -> main + + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git add Source.cpp + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git commit -m "search: минимум" +[main 49aa957] search: минимум + 1 file changed, 5 insertions(+), 2 deletions(-) + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git push +Enter passphrase for key '/c/Users/user/.ssh/id_rsa': +To uit.mpei.ru:MachulinaDV/cs-lab02.git + ! [rejected] main -> main (fetch first) +error: failed to push some refs to 'uit.mpei.ru:MachulinaDV/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. + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git log --oneline --decorate --all --graph +* 49aa957 (HEAD -> main) search: минимум +| * 6ff1d1d (origin/main, origin/HEAD) search: максимум +|/ +* a89ab56 calc: деление +* 287808c calc: +произведение +* 47568ca calc: произведение +* f1c32c5 git: игнорирование файлов +* a0abd05 calc: разность +* e725e82 calc: сумма +* e96354f build: добавление файла проекта +* 670da6a code: заготовка программы + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git rebase origin/main +Auto-merging Source.cpp +CONFLICT (content): Merge conflict in Source.cpp +error: could not apply 49aa957... search: минимум +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 49aa957... search: минимум + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main|REBASE 1/1) +$ git add Source.cpp + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main|REBASE 1/1) +$ git rebase --continue +Successfully rebased and updated refs/heads/main. + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git log --oneline --decorate --all --graph +* 0930f74 (HEAD -> main) search: минимум +* 6ff1d1d (origin/main, origin/HEAD) search: максимум +* a89ab56 calc: деление +* 287808c calc: +произведение +* 47568ca calc: произведение +* f1c32c5 git: игнорирование файлов +* a0abd05 calc: разность +* e725e82 calc: сумма +* e96354f build: добавление файла проекта +* 670da6a code: заготовка программы + +daria@mypc MINGW64 ~/Desktop/cs-lab02/bob/project (main) +$ git push + + +28. Использование веток: +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git checkout -b double + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (double) +$ git add Source.cpp + +daria @mypc MINGW64 ~/Desktop/cs-lab02/bob/project (double) +$ git commit -m "data: изменение типа" + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (double) +$ git checkout main +Switched to branch 'main' +Your branch is up to date with 'origin/main'. + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git fetch + +daria @mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git pull --ff-only + + +daria@mypc MINGW64 ~/Desktop/cs-lab02/alice/project (main) +$ git log --oneline --decorate --all --graph +* 4d39183 (HEAD -> main, origin/main) Merge branch 'double' +|\ +| * 10a168f (origin/double, double) data: изменение типа +* | d18cf6a data: изменение типа +* | 0930f74 search: минимум +* | 6ff1d1d search: максимум +|/ +* a89ab56 calc: деление +* 287808c calc: +произведение +* 47568ca calc: произведение +* f1c32c5 git: игнорирование файлов +* a0abd05 calc: разность +* e725e82 calc: сумма +* e96354f build: добавление файла проекта +* 670da6a code: заготовка программы +