Родитель
6e813a0c70
Сommit
e04a887cb0
@ -1,712 +0,0 @@
|
||||
Отчет по лабораторной работе № 2 "Система контроля версий Git"
|
||||
|
||||
Выполнил: Мусаев Э.В.
|
||||
Группа: А-02-23
|
||||
Проверил:
|
||||
|
||||
Примечание: работа выполнялась на Windows.
|
||||
|
||||
1. Создал на рабочем столе каталог lab02 и запустил в нем Git Bash, приглашение:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02
|
||||
$
|
||||
|
||||
2. Просмотрел файлы в рабочем каталоге можно командой "ls" --- пусто:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02
|
||||
$ ls
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02
|
||||
$
|
||||
|
||||
|
||||
3. Создал каталоги Алисы и Боба, создал каталог "project",
|
||||
изучил команду "cd" в процессе:
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02
|
||||
$ mkdir alice
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02
|
||||
$ mkdir bob
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02
|
||||
$ cd alice
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice
|
||||
$ mkdir project
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice
|
||||
$ cd project
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project
|
||||
$ cd ..
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice
|
||||
$ cd project
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project
|
||||
$
|
||||
|
||||
|
||||
4. Инициализировал репозитарий и сменил название ветки на main:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project
|
||||
$ git init
|
||||
Initialized empty Git repository in C:/Users/root/Desktop/lab02/alice/project/.git/
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (master)
|
||||
$ git branch -m main
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
|
||||
5. Настроил репозиторий Алисы, чтобы коммиты были от ее имени
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git config user.name 'Alice (MusaevEV)'
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git config user.email = 'musayevev@mpei.ru'
|
||||
|
||||
|
||||
6. Создал проект в папку Alice/project
|
||||
|
||||
7. Посмотрел состояние рабочей копии
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git status
|
||||
On branch main- название ветки о которой узнаем состояние
|
||||
|
||||
No commits yet - коммитов нет
|
||||
|
||||
Untracked files: - файлы и катологи которые не индексируются
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
bin/
|
||||
main.cpp
|
||||
obj/
|
||||
project.cbp
|
||||
|
||||
nothing added to commit but untracked files present (use "git add" to track)
|
||||
|
||||
8. Добавил файл main.cpp в индекс
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git add main.cpp
|
||||
|
||||
9. Посмотрел состояние рабочей копии еще раз, убедился что main.cpp добавился в индекс, и выполнил комммит с сообщением.
|
||||
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git status
|
||||
On branch main - название ветки о которой узнаем состояние
|
||||
|
||||
No commits yet - коммитов нет
|
||||
|
||||
Changes to be committed: - новые файлы в индексе
|
||||
(use "git rm --cached <file>..." to unstage)
|
||||
new file: main.cpp
|
||||
|
||||
Untracked files: - неотслеживаемые файлы и каталоги
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
bin/
|
||||
obj/
|
||||
project.cbp
|
||||
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -m 'code: заготовка программы'
|
||||
[main (root-commit) 6f311c2] code: заготовка программы
|
||||
1 file changed, 9 insertions(+)
|
||||
create mode 100644 main.cpp
|
||||
|
||||
10. Добавил новый файл и закоммитил с подходящим по смыслу сообщением
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git add project.cbp
|
||||
warning: in the working copy of 'project.cbp', LF will be replaced by CRLF the next time Git touches it
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -m 'build: add project file'
|
||||
[main e57bf11] build: add project file
|
||||
1 file changed, 40 insertions(+)
|
||||
create mode 100644 project.cbp
|
||||
|
||||
|
||||
|
||||
11. Проверил состояние, увидел сообщение об измененном файле
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git status
|
||||
On branch main
|
||||
Changes not staged for commit:
|
||||
(use "git add <file>..." to update what will be committed)
|
||||
(use "git restore <file>..." to discard changes in working directory)
|
||||
modified: main.cpp
|
||||
|
||||
Untracked files:
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
bin/
|
||||
obj/
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a") - изменений не добавлено с последним коммитом
|
||||
|
||||
Мы изменили файл main.cpp, но не закоммитили изменения, поэтому файл изменен только локально.
|
||||
|
||||
|
||||
12. Добавил все изменения в индекс и закоммитил
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git add -u
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -m "code: update maincode"
|
||||
[main 1952c08] code: update maincode
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
13. Добавил в код вывод разности чисел и закомиитил с изменениями
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -a -m "build: output result"
|
||||
[main 6d86d84] build: output result
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
14. Создал файл .gitignore, внес туда каталоги для игнорирования гитом, после чего добавил файл в индексацию и закоммитил со всеми изменениями
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git status
|
||||
On branch main
|
||||
Untracked files:
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
.gitignore
|
||||
|
||||
nothing added to commit but untracked files present (use "git add" to track)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git add .gitignore
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -a -m "git: ignore build files"
|
||||
[main 7bed447] git: ignore build files
|
||||
1 file changed, 2 insertions(+)
|
||||
create mode 100644 .gitignore
|
||||
|
||||
15. Немного покапаемся в логах, в частости командой git log --stat увидим список коммитов, их названий, авторов, время и какие файлы были затронуты.
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --oneline --decorate --all --graph
|
||||
* 7bed447 (HEAD -> main) git: ignore build files
|
||||
* 6d86d84 build: output result
|
||||
* 1952c08 code: update maincode
|
||||
* e57bf11 build: add project file
|
||||
* 6f311c2 code: заготовка программы
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --oneline --decorate
|
||||
7bed447 (HEAD -> main) git: ignore build files
|
||||
6d86d84 build: output result
|
||||
1952c08 code: update maincode
|
||||
e57bf11 build: add project file
|
||||
6f311c2 code: заготовка программы
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --stat
|
||||
commit 7bed44792ebc74c0cd477a82c68bc7e9011aa85d (HEAD -> main)
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:32:35 2024 +0300
|
||||
|
||||
git: ignore build files
|
||||
|
||||
.gitignore | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
commit 6d86d8487239fe46e165a67339e5a2610d7f082e
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:25:03 2024 +0300
|
||||
|
||||
build: output result
|
||||
|
||||
main.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
commit 1952c08c222191a3157cda663154c55e520dac16
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:21:34 2024 +0300
|
||||
|
||||
code: update maincode
|
||||
:
|
||||
|
||||
16. Проверим коммиты по ключевому слову "BUILD" и увидем 2 наших коммита:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --grep "build:"
|
||||
commit 6d86d8487239fe46e165a67339e5a2610d7f082e
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:25:03 2024 +0300
|
||||
|
||||
build: output result
|
||||
git
|
||||
commit e57bf116e632ae69206d3d42da62e19da76c3677
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:11:42 2024 +0300
|
||||
|
||||
build: add project file
|
||||
|
||||
|
||||
17. проверим коммиты затрагивающие файл project.cbp, увидем 1 такой коммит:
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log -- project.cbp
|
||||
commit e57bf116e632ae69206d3d42da62e19da76c3677
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:11:42 2024 +0300
|
||||
|
||||
build: add project file
|
||||
|
||||
18. Просмотрим предпоследний коммит тремя способами:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git show HEAD~1
|
||||
commit 6d86d8487239fe46e165a67339e5a2610d7f082e
|
||||
Author: Alice (MusaevEV) <=>
|
||||
Date: Fri Apr 5 18:25:03 2024 +0300
|
||||
|
||||
build: output result
|
||||
|
||||
diff --git a/main.cpp b/main.cpp
|
||||
index b903969..8cb02dc 100644
|
||||
--- a/main.cpp
|
||||
+++ b/main.cpp
|
||||
@@ -7,4 +7,5 @@ int main()
|
||||
cout << "Enter A and B: ";
|
||||
int a, b;
|
||||
cin >> a >> b;
|
||||
+cout << "A + B = " << a + b << '\n'
|
||||
}
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git show 6d86d84
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git show main
|
||||
|
||||
19. Добавим в код печать произведения чисел, и посмотрим изменения в рабочей копии
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git diff
|
||||
diff --git a/main.cpp b/main.cpp
|
||||
index 8cb02dc..2813931 100644
|
||||
--- a/main.cpp
|
||||
+++ b/main.cpp
|
||||
@@ -8,4 +8,5 @@ cout << "Enter A and B: ";
|
||||
int a, b;
|
||||
cin >> a >> b;
|
||||
cout << "A + B = " << a + b << '\n'
|
||||
+cout << "A * B = " << a * b << '\n' - видим добавленную строку в код
|
||||
}
|
||||
|
||||
|
||||
20. Посмотрим на изменения первого коммита с коммитом, где был добавлен вывод
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git diff HEAD~3 HEAD~1
|
||||
diff --git a/main.cpp b/main.cpp
|
||||
index b4392ec..8cb02dc 100644
|
||||
--- a/main.cpp
|
||||
+++ b/main.cpp
|
||||
@@ -4,6 +4,8 @@ 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'
|
||||
}
|
||||
|
||||
21. Закоммитим вывод произведения чисел:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -a -m "code: add new output"
|
||||
[main a90c6b6] code: add new output
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
22. Откатим изменения до предпоследнего коммита:
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git reset --hard HEAD~1
|
||||
HEAD is now at 7bed447 git: ignore build files
|
||||
|
||||
|
||||
23. Добавим изменения в файл main.cpp, а потом сбросим их до состояния в последнем коммите
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git checkout HEAD -- main.cpp
|
||||
|
||||
24. Создаем пару ключей, запускаем агента, загружаем ключ, отображаем ключ и добавляем его в список открытых ключей в своей учетке
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ ssh-keygen
|
||||
Generating public/private ed25519 key pair.
|
||||
Enter file in which to save the key (/c/Users/root/.ssh/id_ed25519):
|
||||
Enter passphrase (empty for no passphrase):
|
||||
Enter same passphrase again:
|
||||
Your identification has been saved in /c/Users/root/.ssh/id_ed25519
|
||||
Your public key has been saved in /c/Users/root/.ssh/id_ed25519.pub
|
||||
The key fingerprint is:
|
||||
SHA256:y20hddS010or1h/0PVkxuYS4rthvl8FTyuhR2pAk6rA root@DESKTOP-6PULIAM
|
||||
The key's randomart image is:
|
||||
+--[ED25519 256]--+
|
||||
| oooo.|
|
||||
| . + ..++|
|
||||
| . + + +.=|
|
||||
| . . . = +.*=|
|
||||
| + S o @ *+o|
|
||||
| E o + B O .o|
|
||||
| = = . + .|
|
||||
| . + o o |
|
||||
| o.. |
|
||||
+----[SHA256]-----+
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ eval $(ssh-agent -s)
|
||||
Agent pid 1064
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ ssh-add
|
||||
Enter passphrase for /c/Users/root/.ssh/id_ed25519:
|
||||
Identity added: /c/Users/root/.ssh/id_ed25519 (root@DESKTOP-6PULIAM)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ cat ~/.ssh/id_ed25519.pub
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEngBGNlcVX8rd/friDC+Wnk14610EG5iBFChtfpAXwu root@DESKTOP-6PULIAM
|
||||
|
||||
|
||||
|
||||
25. Устанавливаем соединение по hhtp и отправляем наш репозиторий во всемирную паутину, после чего видим свои файлы на странице с проектом.
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git remote set-url origin http://uit.mpei.ru/git/MusayevEV/cs-lab02.git
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git push -u origin main
|
||||
warning: auto-detection of host provider took too long (>2000ms)
|
||||
warning: see https://aka.ms/gcm/autodetect for more information.
|
||||
Enumerating objects: 15, done.
|
||||
Counting objects: 100% (15/15), done.
|
||||
Delta compression using up to 4 threads
|
||||
Compressing objects: 100% (13/13), done.
|
||||
Writing objects: 100% (15/15), 1.82 KiB | 1.82 MiB/s, done.
|
||||
Total 15 (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/MusayevEV/cs-lab02.git
|
||||
* [new branch] main -> main
|
||||
branch 'main' set up to track 'origin/main'.
|
||||
|
||||
26. Открываем GitBash в папке bob и клонируем туда проект
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob
|
||||
$ git clone http://uit.mpei.ru/git/MusayevEV/cs-lab02.git project
|
||||
Cloning into 'project'...
|
||||
remote: Enumerating objects: 15, done.
|
||||
remote: Counting objects: 100% (15/15), done.
|
||||
remote: Compressing objects: 100% (13/13), done.
|
||||
remote: Total 15 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
Receiving objects: 100% (15/15), done.
|
||||
Resolving deltas: 100% (1/1), done.
|
||||
|
||||
27. Настраиваем config для Bob'а
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob
|
||||
$ cd project
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git config user.name = 'Bob (MusaevEV)'
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git config user.email = 'MusayevEV@mpei.ru'
|
||||
|
||||
28. Добавляем печать произведения чисел, от имени Боба закоммитим и запушим изменения
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git commit -a -m 'code:update bobs proizv'
|
||||
[main bf86356] code:update bobs proizv
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git push
|
||||
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), 360 bytes | 360.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/MusayevEV/cs-lab02.git
|
||||
7bed447..bf86356 main -> main
|
||||
|
||||
|
||||
29. Загружаем изменения Алисе и проверяем что рабочая копия еще не изменена и двигаем ветку Main к скачанной версии
|
||||
|
||||
root@DESKTOP-6PULIAM 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), 340 bytes | 85.00 KiB/s, done.
|
||||
From http://uit.mpei.ru/git/MusayevEV/cs-lab02
|
||||
7bed447..bf86356 main -> origin/main
|
||||
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --oneline --decorate --all --graph
|
||||
* bf86356 (origin/main) code:update bobs proizv
|
||||
* 7bed447 (HEAD -> main) git: ignore build files
|
||||
* 6d86d84 build: output result
|
||||
* 1952c08 code: update maincode
|
||||
* e57bf11 build: add project file
|
||||
* 6f311c2 code: заготовка программы
|
||||
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git pull --ff-only
|
||||
Updating 7bed447..bf86356
|
||||
Fast-forward
|
||||
main.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
30. От имени Алисы меняем код, коммитим, отправляем на сервер и получаем с сервера у боба
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -a -m 'code:all done'
|
||||
warning: in the working copy of 'project.cbp', LF will be replaced by CRLF the next time Git touches it
|
||||
[main c9ae5a4] code:all done
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git push
|
||||
Enumerating objects: 7, done.
|
||||
Counting objects: 100% (7/7), done.
|
||||
Delta compression using up to 4 threads
|
||||
Compressing objects: 100% (4/4), done.
|
||||
Writing objects: 100% (4/4), 437 bytes | 437.00 KiB/s, done.
|
||||
Total 4 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
|
||||
remote: . Processing 1 references
|
||||
remote: Processed 1 references in total
|
||||
To http://uit.mpei.ru/git/MusayevEV/cs-lab02.git
|
||||
bf86356..c9ae5a4 main -> main
|
||||
|
||||
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git pull --ff-only
|
||||
remote: Enumerating objects: 7, done.
|
||||
remote: Counting objects: 100% (7/7), done.
|
||||
remote: Compressing objects: 100% (4/4), done.
|
||||
remote: Total 4 (delta 2), reused 0 (delta 0), pack-reused 0
|
||||
Unpacking objects: 100% (4/4), 417 bytes | 19.00 KiB/s, done.
|
||||
From http://uit.mpei.ru/git/MusayevEV/cs-lab02
|
||||
bf86356..c9ae5a4 main -> origin/main
|
||||
Updating bf86356..c9ae5a4
|
||||
Fast-forward
|
||||
main.cpp | 6 ++++--
|
||||
project.cbp | 1 +
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
|
||||
31. На машине алисы добавим код по выводу максимума, закоммитим и запушим.
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git commit -a -m "code: max done"
|
||||
[main 3642f62] code: max done
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git push
|
||||
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), 413 bytes | 413.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/MusayevEV/cs-lab02.git
|
||||
c9ae5a4..3642f62 main -> main
|
||||
|
||||
32. На машине боба добавим код по нахождению минимума, закоммитим и запушим.
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git commit -a -m "code: min done"
|
||||
[main becfe79] code: min done
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git push
|
||||
To http://uit.mpei.ru/git/MusayevEV/cs-lab02.git
|
||||
! [rejected] main -> main (fetch first)
|
||||
error: failed to push some refs to 'http://uit.mpei.ru/git/MusayevEV/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.
|
||||
|
||||
|
||||
Из-за того что коммит боба основан на неактуальной версии коммита, запушить не удалось
|
||||
|
||||
|
||||
33. Загружаем измненения на машину Боба, проверяем историю веток - видим расхождение. Пытаемся переместить коммит боба поверх коммита алисы - видим конфликт в файле main.cpp
|
||||
|
||||
root@DESKTOP-6PULIAM 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), 393 bytes | 32.00 KiB/s, done.
|
||||
From http://uit.mpei.ru/git/MusayevEV/cs-lab02
|
||||
c9ae5a4..3642f62 main -> origin/main
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main|REBASE 1/1)
|
||||
$ git log --oneline --decorate --all --graph
|
||||
* becfe79 (main) code: min done
|
||||
| * 3642f62 (HEAD, origin/main, origin/HEAD) code: max done
|
||||
|/
|
||||
* c9ae5a4 code:all done
|
||||
* bf86356 code:update bobs proizv
|
||||
* 7bed447 git: ignore build files
|
||||
* 6d86d84 build: output result
|
||||
* 1952c08 code: update maincode
|
||||
* e57bf11 build: add project file
|
||||
* 6f311c2 code: заготовка программы
|
||||
|
||||
root@DESKTOP-6PULIAM 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 becfe79... code: min done
|
||||
hint: Resolve all conflicts manually, mark them as resolved with
|
||||
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
|
||||
hint: You can instead skip this commit: run "git rebase --skip".
|
||||
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
|
||||
Could not apply becfe79... code: min done
|
||||
|
||||
|
||||
34. Исправляем файл боба, чтобы правки Алисы и Боба были учтены вместе. После чего добавляем файл к индексации и продолжаем rebase, после чего убеждаемся в нормализации веток
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main|REBASE 1/1)
|
||||
$ git add main.cpp
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main|REBASE 1/1)
|
||||
$ git rebase --continue
|
||||
Successfully rebased and updated refs/heads/main.
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/bob/project (main)
|
||||
$ git log --oneline --decorate --all --graph
|
||||
* bc5020f (HEAD -> main) code: min done
|
||||
* 3642f62 (origin/main, origin/HEAD) code: max done
|
||||
* c9ae5a4 code:all done
|
||||
* bf86356 code:update bobs proizv
|
||||
* 7bed447 git: ignore build files
|
||||
* 6d86d84 build: output result
|
||||
* 1952c08 code: update maincode
|
||||
* e57bf11 build: add project file
|
||||
* 6f311c2 code: заготовка программы
|
||||
|
||||
|
||||
34. Создаем ветку double и переключаемся на нее
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git branch double
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git checkout double
|
||||
Switched to branch 'double'
|
||||
|
||||
35. Меняем тип данных на double и коммитим
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (double)
|
||||
$ git commit -a -m "code:double alices"
|
||||
[double c000146] code:double alices
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
36. Возвращаемся на ветку main
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (double)
|
||||
$ git checkout main
|
||||
Switched to branch 'main'
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
37.Синхронизируем ветку main с сервером и смотрим на историю всех веток
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git fetch
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --oneline --decorate --all --graph
|
||||
* c000146 (double) code:double alices
|
||||
* 3642f62 (HEAD -> main, origin/main) code: max done
|
||||
* c9ae5a4 code:all done
|
||||
* bf86356 code:update bobs proizv
|
||||
* 7bed447 git: ignore build files
|
||||
* 6d86d84 build: output result
|
||||
* 1952c08 code: update maincode
|
||||
* e57bf11 build: add project file
|
||||
* 6f311c2 code: заготовка программы
|
||||
|
||||
|
||||
38. Сливаем ветку double в main и смотрим историю веток
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git merge double
|
||||
Updating 3642f62..c000146
|
||||
Fast-forward
|
||||
main.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git log --oneline --decorate --all --graph
|
||||
* c000146 (HEAD -> main, double) code:double alices
|
||||
* 3642f62 (origin/main) code: max done
|
||||
* c9ae5a4 code:all done
|
||||
* bf86356 code:update bobs proizv
|
||||
* 7bed447 git: ignore build files
|
||||
* 6d86d84 build: output result
|
||||
* 1952c08 code: update maincode
|
||||
* e57bf11 build: add project file
|
||||
* 6f311c2 code: заготовка программы
|
||||
|
||||
|
||||
|
||||
|
||||
39. Пушим изменения
|
||||
|
||||
root@DESKTOP-6PULIAM MINGW64 ~/desktop/lab02/alice/project (main)
|
||||
$ git push
|
||||
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), 348 bytes | 348.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/MusayevEV/cs-lab02.git
|
||||
3642f62..c000146 main -> main
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче