diff --git a/README.md b/README.md index 87de18a..4872ba2 100644 --- a/README.md +++ b/README.md @@ -88,12 +88,13 @@ $ git commit -m 'code: заготовка программы' $ git add project.cbp warning: in the working copy of 'project.cbp', LF will be replaced by CRLF the n ext time Git touches it - +11. Выполним коммит с файлом main.cpp и темой build: Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) $ git commit -m 'build' [master d2cf070] build 1 file changed, 40 insertions(+) create mode 100644 project.cbp +12. Посмотрим состояние рабочей копии Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) $ git status @@ -108,3 +109,167 @@ Untracked files: project.layout no changes added to commit (use "git add" and/or "git commit -a") + + 13. Заменим тело функции main() на ввод двух чисел: + +cout << "Enter A and B: "; +int a, b; +cin >> a >> b; + +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git status +On branch master +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) + project.layout + bin/ + obj/ + +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git add main.cpp + +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git commit -m "added search for the sum of numbers" +[master 3c32ed0] added search for the sum of numbers + 1 file changed, 4 insertions(+), 2 deletions(-) + + Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git commit -a -m "added search for the sum and dif" +[master 3b4f949] added search for the sum and dif + 1 file changed, 2 insertions(+) +15. Укажем Git игнорировать присутствие каталога bin. Для этого создадим в CodeBlocks новый файл (File → New... → Empty) и запишем в него строку: + +/bin +добавим новый файл в индекс +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git add .gitignore + +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git commit -m "git" +[master 3fa2b6a] git + 1 file changed, 2 insertions(+) + create mode 100644 .gitignore + +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git status +On branch master +Untracked files: + (use "git add ..." to include in what will be committed) + project.depend + project.layout + +nothing added to commit but untracked files present (use "git add" to track) +16. Просмотр истории +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git log --stat +commit 3fa2b6a62dab4509956db6d66b1071240733f214 (HEAD -> master) +Author: Alice (KarelinaMK) +Date: Mon Mar 6 15:10:17 2023 +0300 + + git + + .gitignore | 2 ++ + 1 file changed, 2 insertions(+) + +commit 3b4f9498587d54632d066d3d585eb1364cd464ef +Author: Alice (KarelinaMK) +Date: Mon Mar 6 14:49:50 2023 +0300 + + added search for the sum of numbers + + main.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +commit d2cf070b25b6b9568b8a746ba6f8451ed3d2e045 +Author: Alice (KarelinaMK) +Date: Mon Mar 6 14:27:02 2023 +0300 + + build + + project.cbp | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +commit f3f527116c9e0798e9f6169012fc9ef339e5427f +Author: Alice (KarelinaMK) +Date: Mon Mar 6 14:18:52 2023 +0300 + + code: заготовка программы + + main.cpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + 17. просмотр коммитов + Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git show HEAD~1 +commit 3b4f9498587d54632d066d3d585eb1364cd464ef +Author: Alice (KarelinaMK) +Date: Mon Mar 6 14:49:50 2023 +0300 + + added search for the sum and dif + +diff --git a/main.cpp b/main.cpp +index 04c77d9..6f78dbd 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' ++ << "A - B = " << a - b << '\n'; + + } + 18. Просмотр изменений + Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git diff +diff --git a/main.cpp b/main.cpp // разница между алисой и бобом +index 6f78dbd..cc11ab1 100644 // хэш файла +--- a/main.cpp ++++ b/main.cpp +@@ -8,6 +8,7 @@ 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'; + + } + +Просмотрим историю всех веток +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (master) +$ git log --oneline --decorate --all + + +* 6b0ae13 (HEAD, master) min bob + +eeb2598 (origin/master, origin/HEAD) max al + +da439d7 del al +261c99c mult bob +992780d first commit +3fa2b6a git +3b4f949 added search for the sum and dif +3c32ed0 added search for the sum of numbers +d2cf070 build +f3f5271 code: заготовка программы +20. Синхронизируйте ветку main «на машине Алисы» с сервером. Просмотрите историю всех веток и занесите результат в отчет. +Мария@Note-Mary MINGW64 ~/Desktop/lab02/alice/project (main|MERGING) +$ git log --oneline --decorate --all +1b91802 (double) double +6b0ae13 (origin/main, origin/HEAD) min bob +eeb2598 (HEAD -> main) max al +da439d7 del al +261c99c mult bob +992780d first commit +3fa2b6a git +3b4f949 added search for the sum and dif +3c32ed0 added search for the sum of numbers +d2cf070 build +f3f5271 code: заготовка программы + +