Отчет по лабораторной работе № 2 "Система контроля версий Git" Выполнил: Долганов В. И. Группа: А-01-24 Проверил: Челышев Э.А./Филатов С.А. Примечание: работа выполнялась на Windows. 1. Создал на рабочем столе каталог lab02 и запустил в нем Git Bash, приглашение: INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ 2. Просмотрел файлы в рабочем каталоге можно командой "ls" --- пусто: INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ ls INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ 3. Создал каталоги Алисы и Боба, создал каталог "project", изучил команду "cd" в процессе: INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ mkdir alice INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ mkdir bob INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ cd bob INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob $ cd .. INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02 $ cd alice INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice $ mkdir project INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice $ cd project INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project $ cd .. INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice $ cd project INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project $ 4. Инициализировал репозитарий: INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project $ git init Initialized empty Git repository in C:/Users/INTEL/Desktop/lab02/alice/project/.git/ INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (master) $ git branch -m main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ ls -A .git/ INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git config user.name 'Alice (DolganovVI)' INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git config user.email 'DolganovVI@mpei.ru' 5. Занесение файлов под контроль версий INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git status On branch main No commits yet Untracked files: (use "git add ..." to include in what will be committed) .vs/ main.cpp project.sln project.vcxproj project.vcxproj.filters project.vcxproj.user nothing added to commit but untracked files present (use "git add" to track) //////////////////////// ПОЯСНЕНИЕ: $ git status - Это выполненная команда, которая показывает состояние репозитория. On branch main - Указывает, что вы находитесь в ветке main. No commits yet - В репозитории пока нет ни одного коммита. Untracked files: - Список файлов, которые Git видит в папке, но ещё не отслеживает. (use "git add ..." to include in what will be committed) - Подсказка: чтобы начать отслеживать файлы, нужно использовать команду git add. Список файлов (.vs/, main.cpp, project.sln, project.vcxproj) - Это файлы, которые Git обнаружил в папке, но пока не отслеживает: nothing added to commit but untracked files present (use "git add" to track) - нет файлов в индексе для коммита, но есть неотслеживаемые файлы (используйте git add, чтобы начать их отслеживать). //////////////////////// INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/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) .vs/ project.sln project.vcxproj project.vcxproj.filters project.vcxproj.user //////////////////////// ПОЯСНЕНИЕ: $ git status - Это выполненная команда, которая показывает состояние репозитория. On branch main - Указывает, что вы находитесь в ветке main. No commits yet - В репозитории пока нет ни одного коммита. Changes to be committed: - Файлы, добавленные в индекс (git add), которые попадут в следующий коммит. (use "git rm --cached ..." to unstage) - Подсказка: если нужно убрать файл из индекса (перед коммитом), используйте git rm --cached. new file: main.cpp - Файл main.cpp добавлен в staging area (его изменения будут зафиксированы при коммите). Untracked files: - Список файлов, которые Git видит в папке, но ещё не отслеживает. (use "git add ..." to include in what will be committed) - Подсказка: чтобы начать отслеживать файлы, нужно использовать команду git add. Список файлов (.vs/, main.cpp, project.sln, project.vcxproj) - Это файлы, которые Git обнаружил в папке, но пока не отслеживает: //////////////////////// INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: заготовка программы' [main (root-commit) 32a7db9] code: заготовка программы 1 file changed, 20 insertions(+) create mode 100644 main.cpp 6. Составление сообщений к коммитам INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add project.sln INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'build: добавлен файл проекта' [main 6e1cc21] build: добавлен файл проекта 1 file changed, 31 insertions(+) create mode 100644 project.sln 7. Создание коммитов с изменениями INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/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) .vs/ project.vcxproj project.vcxproj.filters project.vcxproj.user no changes added to commit (use "git add" and/or "git commit -a") //////////////////////// Изменения: отметка "modified: main.cpp" означает, что файл main.cpp был изменен //////////////////////// INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: изменение тела функции main на ввод двух чисел' [main de4a61e] code: изменение тела функции main на ввод двух чисел 1 file changed, 6 insertions(+), 16 deletions(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add -u INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: сумма a и b' [main 5f89d5c] code: сумма a и b 1 file changed, 1 insertion(+), 1 deletion(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: разность a и b' [main 6e34968] code: разность a и b 1 file changed, 3 insertions(+), 1 deletion(-) 8.Игнорирование файлов INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git status On branch main Untracked files: (use "git add ..." to include in what will be committed) .gitignore project.vcxproj project.vcxproj.filters nothing added to commit but untracked files present (use "git add" to track) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add .gitignore warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m "git: добавлено игнорирование бинарных файлов" [main 059ffcd] git: добавлено игнорирование бинарных файлов 1 file changed, 400 insertions(+) create mode 100644 .gitignore 9. Работа с журналом репозитария INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --stat commit 059ffcd969b0d07cb58fb05cb44622a1fcbaf4d7 (HEAD -> main) Author: Alice (DolganovVI) Date: Sun Mar 30 22:46:43 2025 +0300 git: добавлено игнорирование бинарных файлов .gitignore | 400 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 400 insertions(+) commit 6e34968f77c6ed8a54ddd0245d76df825a3fba9b Author: Alice (DolganovVI) Date: Sun Mar 30 22:43:11 2025 +0300 code: разность a и b main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) commit 5f89d5c56d23b216b1d7d20c6fdd33e137902a35 Author: Alice (DolganovVI) Date: Sun Mar 30 22:42:25 2025 +0300 code: сумма a и b main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit de4a61ef58ba3a8c5e604401a65b540a5e1e82f7 Author: Alice (DolganovVI) Date: Sun Mar 30 22:40:23 2025 +0300 code: изменение тела функции main на ввод двух чисел main.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) commit 6e1cc21738ea03eea8b327d33531e2bb7425fc4b Author: Alice (DolganovVI) Date: Sun Mar 30 22:38:24 2025 +0300 build: добавлен файл проекта project.sln | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) commit 32a7db99c0df8091f98c4bccf0a2e3450f8b7f1c Author: Alice (DolganovVI) Date: Sun Mar 30 22:37:25 2025 +0300 code: заготовка программы main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log -- project.sln commit 6e1cc21738ea03eea8b327d33531e2bb7425fc4b Author: Alice (DolganovVI) Date: Sun Mar 30 22:38:24 2025 +0300 build: добавлен файл проекта INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --grep "build:" commit 6e1cc21738ea03eea8b327d33531e2bb7425fc4b Author: Alice (DolganovVI) Date: Sun Mar 30 22:38:24 2025 +0300 build: добавлен файл проекта ////////////////// ПОЯСНЕНИЕ: commit 059ffcd969b0d07cb58fb05cb44622a1fcbaf4d7 (HEAD -> main) (коммит, его хэш и указатель текущего положения) Author: Alice (DolganovVI) (информация об авторе) Date: Sun Mar 30 22:46:43 2025 +0300 (дата коммита) git: добавлено игнорирование бинарных файлов (сообщение коммита) .gitignore | 400 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 400 insertions(+) (.gitignore - имя измененного файла 400 + - добавлено 400 строк (каждая + обычно означает 1 строку, но может масштабироваться) 1 file changed - всего изменен 1 файл 400 insertions(+) - суммарно добавлено 400 строк (без удалений)) ////////////////// 10. Просмотр коммитов INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git show HEAD~1 commit 6e34968f77c6ed8a54ddd0245d76df825a3fba9b Author: Alice (DolganovVI) Date: Sun Mar 30 22:43:11 2025 +0300 code: разность a и b diff --git a/main.cpp b/main.cpp index 4825241..954945a 100644 --- a/main.cpp +++ b/main.cpp @@ -6,5 +6,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'; + } 11. Просмотр изменений INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git diff diff --git a/main.cpp b/main.cpp index 954945a..fc54e71 100644 --- a/main.cpp +++ b/main.cpp @@ -7,6 +7,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'; } /////////////// Пояснение(построчные): 1)Показывает, что сравниваются две версии файла main.cpp: a/main.cpp - старая версия b/main.cpp - новая версия 2)Хеши версий файла: 954945a - хеш старой версии fc54e71 - хеш новой версии 100644 - права доступа к файлу 3) Заголовки у файлов --- - обозначает старую версию +++ - обозначает новую версию 4)Описание изменяемого блока: -7,6 - в старой версии: начиная с 7 строки, 6 строк текста +7,7 - в новой версии: начиная с 7 строки, 7 строк текста int main() - блок кода, где происходят изменения 5) Строки без префикса - неизмененный текст Строка с - - удаленная строка Строки с + - добавленные строки /////////////// INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git diff HEAD~2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a4fe18b --- /dev/null +++ b/.gitignore @@ -0,0 +1,400 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +# but not Directory.Build.rsp, as it configures directory-level build defaults +!Directory.Build.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/main.cpp b/main.cpp index 4825241..fc54e71 100644 --- a/main.cpp +++ b/main.cpp @@ -6,5 +6,8 @@ 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'; + } INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * 059ffcd (HEAD -> main) git: добавлено игнорирование бинарных файлов * 6e34968 code: разность a и b * 5f89d5c code: сумма a и b * de4a61e code: изменение тела функции main на ввод двух чисел * 6e1cc21 build: добавлен файл проекта * 32a7db9 code: заготовка программы INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git diff 32a7db 6e3496 diff --git a/main.cpp b/main.cpp index a60f2ae..954945a 100644 --- a/main.cpp +++ b/main.cpp @@ -1,20 +1,12 @@ -// project.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. -// - + #include - +using namespace std; int main() { - std::cout << "Hello World!\n"; -} + cout << "Enter A and B: "; + int a, b; + cin >> a >> b; + cout << "A + B = " << a + b << '\n' + << "A - B = " << a - b << '\n'; -// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки" -// Отладка программы: F5 или меню "Отладка" > "Запустить отладку" - -// Советы по началу работы -// 1. В окне обозревателя решений можно добавлять файлы и управлять ими. -// 2. В окне Team Explorer можно подключиться к системе управления версиями. -// 3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения. -// 4. В окне "Список ошибок" можно просматривать ошибки. -// 5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода. -// 6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл. +} diff --git a/project.sln b/project.sln new file mode 100644 index 0000000..2b41c69 --- /dev/null +++ b/project.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35806.99 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "project", "project.vcxproj", "{01C23D8D-8170-4AF1-AB44-7CF500EC55F7}" +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 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Debug|x64.ActiveCfg = Debug|x64 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Debug|x64.Build.0 = Debug|x64 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Debug|x86.ActiveCfg = Debug|Win32 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Debug|x86.Build.0 = Debug|Win32 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Release|x64.ActiveCfg = Release|x64 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Release|x64.Build.0 = Release|x64 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Release|x86.ActiveCfg = Release|Win32 + {01C23D8D-8170-4AF1-AB44-7CF500EC55F7}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4288B640-8481-46D4-A12A-8A241C78EF6C} + EndGlobalSection +EndGlobal 12. Откат изменений INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: пр-е a и b' [main 3355a89] code: пр-е a и b 1 file changed, 2 insertions(+), 1 deletion(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git reset --hard HEAD~1 HEAD is now at 059ffcd git: добавлено игнорирование бинарных файлов INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git checkout HEAD -- main.cpp 13. Обмен кодом через удаленное хранилище INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ ssh-keygen Generating public/private ed25519 key pair. Enter file in which to save the key (/c/Users/INTEL/.ssh/id_ed25519): Enter passphrase for "/c/Users/INTEL/.ssh/id_ed25519" (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/INTEL/.ssh/id_ed25519 Your public key has been saved in /c/Users/INTEL/.ssh/id_ed25519.pub The key fingerprint is: SHA256:+2j4v7lL1TSCAu1B+pJqn64OBiUojK6HJlvHaERt1j0 INTEL@DESKTOP-R1Q3U7V The key's randomart image is: +--[ED25519 256]--+ | .o. | |+ . . +o . | |=.o + o.E.. . o | |o+ o o.o + . | |... o S . . | |.+ o . . . . | |+.B = .. . | |o* + ....+ . | |. .oo+oo.B+ | +----[SHA256]-----+ INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ eval $(ssh-agent -s) Agent pid 1165 INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ ssh-add Enter passphrase for /c/Users/INTEL/.ssh/id_ed25519: Identity added: /c/Users/INTEL/.ssh/id_ed25519 (INTEL@DESKTOP-R1Q3U7V) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ cat ~/.ssh/id_ed25519.pub ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIsoZYKg9bZLLmTypBtrEpD2qsVHL3abWv4scyb14E23 INTEL@DESKTOP-R1Q3U7V 14. Отправка проекта на сервер INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git remote add origin http://uit.mpei.ru/git/DolganovVI/cs-lab02.git INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git push -u origin main Enumerating objects: 18, done. Counting objects: 100% (18/18), done. Delta compression using up to 16 threads Compressing objects: 100% (17/17), done. Writing objects: 100% (18/18), 5.95 KiB | 870.00 KiB/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/DolganovVI/cs-lab02.git * [new branch] main -> main branch 'main' set up to track 'origin/main'. 15.Получение проекта с сервера INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob $ git clone http://uit.mpei.ru/git/DolganovVI/cs-lab02.git project Cloning into 'project'... remote: Enumerating objects: 18, done. remote: Counting objects: 100% (18/18), done. remote: Compressing objects: 100% (17/17), done. remote: Total 18 (delta 2), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (18/18), 5.95 KiB | 1.19 MiB/s, done. Resolving deltas: 100% (2/2), done. INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob $ cd project INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git config user.name 'Bob (DolganovVI)' INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git config user.email 'DolganovVI@mpei.ru' 16. Совместная работа над проектом без конфликтов правок INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git status On branch main Your branch is up to date with 'origin/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 no changes added to commit (use "git add" and/or "git commit -a") INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git commit -m "code: добавлено умножение" [main d620934] code: добавлено умножение 1 file changed, 2 insertions(+), 1 deletion(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 16 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 414 bytes | 414.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/DolganovVI/cs-lab02.git 059ffcd..d620934 main -> main INTEL@DESKTOP-R1Q3U7V 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 | 28.00 KiB/s, done. From http://uit.mpei.ru/git/DolganovVI/cs-lab02 059ffcd..d620934 main -> origin/main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * d620934 (origin/main, origin/HEAD) code: добавлено умножение * 059ffcd (HEAD -> main) git: добавлено игнорирование бинарных файлов * 6e34968 code: разность a и b * 5f89d5c code: сумма a и b * de4a61e code: изменение тела функции main на ввод двух чисел * 6e1cc21 build: добавлен файл проекта * 32a7db9 code: заготовка программы INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git pull --ff-only Updating 059ffcd..d620934 Fast-forward main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: добавлено деление a и b' [main 4dc75b4] code: добавлено деление a и b 1 file changed, 2 insertions(+), 1 deletion(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 16 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 412 bytes | 412.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/DolganovVI/cs-lab02.git d620934..4dc75b4 main -> main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git fetch remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 392 bytes | 14.00 KiB/s, done. From http://uit.mpei.ru/git/DolganovVI/cs-lab02 d620934..4dc75b4 main -> origin/main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git pull --ff-only Updating d620934..4dc75b4 Fast-forward main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 17. Разрешение конфликтов правок при совместной работе INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git commit -m 'code: добавлена печать максимума' [main 81510b4] code: добавлена печать максимума 1 file changed, 8 insertions(+) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 16 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 468 bytes | 468.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/DolganovVI/cs-lab02.git 4dc75b4..81510b4 main -> main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git commit -m "code: добавлена печать минимума" [main 9f5a8f6] code: добавлена печать минимума 1 file changed, 10 insertions(+) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git push To http://uit.mpei.ru/git/DolganovVI/cs-lab02.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'http://uit.mpei.ru/git/DolganovVI/cs-lab02.git' hint: Updates were rejected because the remote contains work that you do not hint: have locally. This is usually caused by another repository pushing to hint: the same ref. If you want to integrate the remote changes, use hint: 'git pull' before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git fetch remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 448 bytes | 15.00 KiB/s, done. From http://uit.mpei.ru/git/DolganovVI/cs-lab02 4dc75b4..81510b4 main -> origin/main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git log --oneline --decorate --all --graph * 9f5a8f6 (HEAD -> main) code: добавлена печать минимума | * 81510b4 (origin/main, origin/HEAD) code: добавлена печать максимума |/ * 4dc75b4 code: добавлено деление a и b * d620934 code: добавлено умножение * 059ffcd git: добавлено игнорирование бинарных файлов * 6e34968 code: разность a и b * 5f89d5c code: сумма a и b * de4a61e code: изменение тела функции main на ввод двух чисел * 6e1cc21 build: добавлен файл проекта * 32a7db9 code: заготовка программы //////////////////////// Пояснения: Анализ текущего состояния: Разветвление истории: Есть две параллельные линии разработки: 1)Локальная (main с коммитом 9f5a8f6) 2)Удаленная (origin/main с коммитом 81510b4) Последние изменения: 1)Локально добавлена печать минимума //////////////////////// INTEL@DESKTOP-R1Q3U7V 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 9f5a8f6... 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". hint: Disable this message with "git config set advice.mergeConflict false" Could not apply 9f5a8f6... code: добавлена печать минимума INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git rebase --continue Открылся VIM [detached HEAD f3a6435] code: добавлена печать минимума 1 file changed, 11 insertions(+) Successfully rebased and updated refs/heads/main. INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/bob/project (main) $ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 16 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 472 bytes | 472.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/DolganovVI/cs-lab02.git 81510b4..f3a6435 main -> main 18. Использование веток INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git branch double INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git checkout double Switched to branch 'double' INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (double) $ git add main.cpp INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (double) $ git commit -m 'code: тип данных у переменной a и b поменян на double' [double 0ae3626] code: тип данных у переменной a и b поменян на double 1 file changed, 1 insertion(+), 1 deletion(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git pull origin main 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), 452 bytes | 12.00 KiB/s, done. From http://uit.mpei.ru/git/DolganovVI/cs-lab02 * branch main -> FETCH_HEAD 81510b4..f3a6435 main -> origin/main Updating 81510b4..f3a6435 Fast-forward main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * 0ae3626 (double) code: тип данных у переменной a и b поменян на double | * f3a6435 (HEAD -> main, origin/main, origin/HEAD) code: добавлена печать минимума |/ * 81510b4 code: добавлена печать максимума * 4dc75b4 code: добавлено деление a и b * d620934 code: добавлено умножение * 059ffcd git: добавлено игнорирование бинарных файлов * 6e34968 code: разность a и b * 5f89d5c code: сумма a и b * de4a61e code: изменение тела функции main на ввод двух чисел * 6e1cc21 build: добавлен файл проекта * 32a7db9 code: заготовка программы INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (double) $ git checkout main Switched to branch 'main' Your branch is up to date with 'origin/main'. INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git status On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add ..." to include in what will be committed) project.vcxproj project.vcxproj.filters nothing added to commit but untracked files present (use "git add" to track) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * 7323038 (double) code: тип данных у переменной a и b поменян на double * 6948e55 (HEAD -> main, origin/main, origin/HEAD) code: добавлена печать максимума * 0d7d739 code: деление a и b * 354efcd code: добавлено умножение * 7e2b56b git: добавлено игнорирование бинарных файлов * 7202a98 code: разность a и b * 54c758d code: сумма a и b * fee73e9 code: изменение тела функции main на ввод двух чисел * dd16e29 build: добавлен файл проекта * 2af5052 code: заготовка программы INTEL@DESKTOP-R1Q3U7V 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(-) INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git push Enumerating objects: 10, done. Counting objects: 100% (10/10), done. Delta compression using up to 16 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 759 bytes | 379.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/DolganovVI/cs-lab02.git f3a6435..2c2c926 main -> main INTEL@DESKTOP-R1Q3U7V MINGW64 ~/Desktop/lab02/alice/project (main) $ git log --oneline --decorate --all --graph * 2c2c926 (HEAD -> main, origin/main, origin/HEAD) Merge branch 'double' |\ | * 0ae3626 (double) code: тип данных у переменной a и b поменян на double * | f3a6435 code: добавлена печать минимума |/ * 81510b4 code: добавлена печать максимума * 4dc75b4 code: добавлено деление a и b * d620934 code: добавлено умножение * 059ffcd git: добавлено игнорирование бинарных файлов * 6e34968 code: разность a и b * 5f89d5c code: сумма a и b * de4a61e code: изменение тела функции main на ввод двух чисел * 6e1cc21 build: добавлен файл проекта * 32a7db9 code: заготовка программы