Родитель
8525476835
Сommit
d72343eb57
@ -0,0 +1,630 @@
|
||||
Отчет по лабораторной работе № 2 "Система контроля версий Git"
|
||||
|
||||
Выполнил: Фонов А. Д.
|
||||
Группа: А-01-22
|
||||
Проверил: Козлюк Д. А.
|
||||
|
||||
Примечание: работа выполнялась на macOS.
|
||||
|
||||
1. Создал на рабочем столе каталог lab02. Перешел к папке через cd:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr ~ % cd /Users/aleksandr/Desktop/labs/lab02
|
||||
|
||||
2. Просмотрел файлы в рабочем каталоге можно командой "ls" --- пусто:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr lab02
|
||||
% ls
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr lab02
|
||||
%
|
||||
|
||||
3. Создал каталоги Алисы и Боба, создал каталог "project",
|
||||
изучил команду "cd" в процессе:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr lab02
|
||||
% mkdir alice
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr lab02
|
||||
% mkdir bob
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr lab02
|
||||
% cd bob
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr bob
|
||||
% cd ..
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr lab02
|
||||
% cd alice
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr alice
|
||||
% mkdir project
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr alice
|
||||
% ls
|
||||
project
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr alice
|
||||
% cd project
|
||||
|
||||
4. Инициализировал репозитарий:
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git init
|
||||
|
||||
hint: Using 'master' as the name for the initial branch. This default branch name
|
||||
hint: is subject to change. To configure the initial branch name to use in all
|
||||
hint: of your new repositories, which will suppress this warning, call:
|
||||
hint:
|
||||
hint: git config --global init.defaultBranch <name>
|
||||
hint:
|
||||
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
|
||||
hint: 'development'. The just-created branch can be renamed via this command:
|
||||
hint:
|
||||
hint: git branch -m <name>
|
||||
Initialized empty Git repository in /Users/aleksandr/Desktop/labs/lab02/alice/project/.git
|
||||
|
||||
5. Переименовал ветку на main:
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git branch -m 'main'
|
||||
|
||||
6. Настроил репозиторий Алисы
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git config user.name 'Alice (FonovAD)'
|
||||
|
||||
aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git config user.email 'fonovad@mpei.ru'
|
||||
|
||||
7. Создал файлы проекта:
|
||||
aleksandr@MacBook-Pro-Aleksandr project
|
||||
% ls -a
|
||||
. .. .git main.cpp project.cbp
|
||||
|
||||
8. Занесение файлов под контроль версий:
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git status
|
||||
On branch main
|
||||
|
||||
No commits yet
|
||||
|
||||
Untracked files:
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
main.cpp
|
||||
project.cbp
|
||||
|
||||
nothing added to commit but untracked files present (use "git add" to track)
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git add main.cpp
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% 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)
|
||||
project.cbp
|
||||
|
||||
После добавления файла в индекс, git указывает этот файл в "Изменения, которые необходимо внести:"
|
||||
project.cbp остается неотслеживаемым.
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git commit -m 'code: заготовка программы'
|
||||
|
||||
[main (root-commit) 7fe833c] code: заготовка программы
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
create mode 100644 main.cpp
|
||||
|
||||
9.Добавление изменений в main и коммит их:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project % 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)
|
||||
project.cbp
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git add main.cpp
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git commit -m "..."
|
||||
[main 4e0ecf8] ...
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
10. Добавление изменений в main и коммит:
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% 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)
|
||||
.vscode/
|
||||
main.dSYM/
|
||||
project.cbp
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git commit -a -m "..."
|
||||
[main fb1c217] ...
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
11. Игнорирование файлов.
|
||||
Создал папку bin и файл .gitignore
|
||||
|
||||
% git status
|
||||
On branch main
|
||||
Untracked files:
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
.DS_Store
|
||||
.gitignore
|
||||
.vscode/
|
||||
main
|
||||
main.dSYM/
|
||||
project.cbp
|
||||
|
||||
nothing added to commit but untracked files present (use "git add" to track)
|
||||
|
||||
Папка bin не отображается
|
||||
|
||||
12. Работа с журналом репозитория:
|
||||
aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git log
|
||||
commit fb1c2170039ff464c2f689a712738532a0561765 (HEAD -> main)
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:22:48 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
commit 4e0ecf82b57d65e924181ecb02c75e61c7a0dc4f
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:16:45 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
commit 7fe833c324315f8a864a948f882f89764df0ab38
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:08:12 2023 +0300
|
||||
|
||||
code: заготовка программы
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git log --stat
|
||||
commit fb1c2170039ff464c2f689a712738532a0561765 (HEAD -> main)
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:22:48 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
main.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
commit 4e0ecf82b57d65e924181ecb02c75e61c7a0dc4f
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:16:45 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
main.cpp | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
commit 7fe833c324315f8a864a948f882f89764df0ab38
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:08:12 2023 +0300
|
||||
|
||||
code: заготовка программы
|
||||
|
||||
main.cpp | 0
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
|
||||
Команда git log --stat показывает количество добавленных и удаленных строк, дату изменения и автора. Так же показывает сколько и какие файлы изменены.
|
||||
|
||||
|
||||
12. Просмотр предпоследнего коммита:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git show 4e0ecf8
|
||||
commit 4e0ecf82b57d65e924181ecb02c75e61c7a0dc4f
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:16:45 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
diff --git a/main.cpp b/main.cpp
|
||||
index e69de29..eb7dcff 100644
|
||||
--- a/main.cpp
|
||||
+++ b/main.cpp
|
||||
@@ -0,0 +1,10 @@
|
||||
+#include <iostream>
|
||||
+
|
||||
+using namespase std;
|
||||
+
|
||||
+int main(){
|
||||
+ cout << "Enter A and B: ";
|
||||
+ int a, b;
|
||||
+ cin >> a >> b;
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
|
||||
|
||||
13. Просмотр изменений
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git diff
|
||||
|
||||
diff --git a/main.cpp b/main.cpp
|
||||
index 6b7cc10..f6ba761 100644
|
||||
--- a/main.cpp
|
||||
+++ b/main.cpp
|
||||
@@ -6,7 +6,8 @@ int main(){
|
||||
cout << "Enter A and B: ";
|
||||
int a, b;
|
||||
cin >> a >> b;
|
||||
- return 0;
|
||||
cout << "A + B = " << a + b << '\n'
|
||||
<< "A - B = " << a - b << '\n';
|
||||
+ cout << 1;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
Команда показывает изменённый файл и часть кода, которая претерпела изменения.
|
||||
|
||||
|
||||
Изменения между самым первым коммитом и коммитом, добавляющим вывод разности:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git diff 7fe833c fb1c217
|
||||
diff --git a/main.cpp b/main.cpp
|
||||
index e69de29..6b7cc10 100644
|
||||
--- a/main.cpp
|
||||
+++ b/main.cpp
|
||||
@@ -0,0 +1,12 @@
|
||||
+#include <iostream>
|
||||
+
|
||||
+using namespace std;
|
||||
+
|
||||
+int main(){
|
||||
+ cout << "Enter A and B: ";
|
||||
+ int a, b;
|
||||
+ cin >> a >> b;
|
||||
+ return 0;
|
||||
+ cout << "A + B = " << a + b << '\n'
|
||||
+ << "A - B = " << a - b << '\n';
|
||||
+}
|
||||
|
||||
|
||||
14. Откат изменений:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git reset --hard HEAD~1
|
||||
|
||||
HEAD is now at fb1c217 ...
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git checkout HEAD -- main.cpp
|
||||
|
||||
15. Настройка SSH
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project % ssh-keygen
|
||||
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (/Users/aleksandr/.ssh/id_rsa):
|
||||
Created directory '/Users/aleksandr/.ssh'.
|
||||
Enter passphrase (empty for no passphrase):
|
||||
Enter same passphrase again:
|
||||
Your identification has been saved in /Users/aleksandr/.ssh/id_rsa
|
||||
Your public key has been saved in /Users/aleksandr/.ssh/id_rsa.pub
|
||||
The key fingerprint is:
|
||||
SHA256:BSL8yEn4NZB7RQ7Xgxh8rqgcueObtkRui6QEWHFWUxo aleksandr@MacBook-Pro-Aleksandr.local
|
||||
The key's randomart image is:
|
||||
+---[RSA 3072]----+
|
||||
| .o==E==o |
|
||||
| .++.=O+.o |
|
||||
| .+ *.=. .. |
|
||||
|.. * o .. |
|
||||
|o .. o .S |
|
||||
|.oo . . |
|
||||
| +++ |
|
||||
|++*o |
|
||||
|oo*+ |
|
||||
+----[SHA256]-----+
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% eval `ssh-agent -s`
|
||||
|
||||
Agent pid 91639
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% ssh-add
|
||||
|
||||
Enter passphrase for /Users/aleksandr/.ssh/id_rsa:
|
||||
Identity added: /Users/aleksandr/.ssh/id_rsa (aleksandr@MacBook-Pro-Aleksandr.local)
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% cat ~/.ssh/id_rsa.pub
|
||||
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCqTjyqz+vTiJ3yTilqhd9fRbX92JRUo7UjqsTJZRtXzTiKxidi5FrYxTPFxcvZQhwWLYoUXmcfp2CCjGT51NA73ISF94brAJF9ZmvohDYjJrQQvvy9wYQa2+WO3lR/9L/v7PZCN++kR2P/3H+ptj69NKNaMQvR7tA4kRGyHzqDm2cvqszVyRQOfajqerFUVJN9V6odElt0mjOoSU4Xz7RkzxOB33ChPUDTHTxoGXCCsyOn/vxOzFJVXsa5tULKqCqTIFbYfnGraPbTf7MosjqLQ7tWpRapZnpjbwZKxA+07CCqpf+vlp0FerzQbU9ppJWMA1uP8jIwN3bAOVQRHHAzC6ASUt2pUrrX17eJdl4uFI5vw+z/HFO/LSbV6aVCLGS442gMpcuSyyHiMi8oaxqACpSKTFsQ0hAyicJ6DcW/4gxK7dptUo3iZ20/PAyEZDWiVY/W9Mptez6/Dh17oLAcXlR2EVVpeobEsuM8tOiazo3E5fWOSVaODrW+uYHGju0= aleksandr@MacBook-Pro-Aleksandr.local
|
||||
|
||||
16. Отправка проекта на сервер:
|
||||
|
||||
Создал проект cs-lab02 на http://uit.mpei.ru
|
||||
Ввел ключ SSH, выполнил команды
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git remote add origin git@uit.mpei.ru:Fonov_Alexandr/cs-lab02.git
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git push -u origin main
|
||||
|
||||
Enumerating objects: 9, done.
|
||||
Counting objects: 100% (9/9), done.
|
||||
Delta compression using up to 8 threads
|
||||
Compressing objects: 100% (5/5), done.
|
||||
Writing objects: 100% (9/9), 818 bytes | 818.00 KiB/s, done.
|
||||
Total 9 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
remote: . Processing 1 references
|
||||
remote: Processed 1 references in total
|
||||
To uit.mpei.ru:Fonov_Alexandr/cs-lab02.git
|
||||
* [new branch] main -> main
|
||||
Branch 'main' set up to track remote branch 'main' from 'origin'.
|
||||
|
||||
17. Получение проекта с сервера
|
||||
|
||||
Создал папку project в папку bob, инициализоровал git.
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git clone git@uit.mpei.ru:Fonov_Alexandr/cs-lab02.git /Users/aleksandr/Desktop/labs/lab02/bob/project
|
||||
Cloning into '/Users/aleksandr/Desktop/labs/lab02/bob/project'...
|
||||
remote: Enumerating objects: 9, done.
|
||||
remote: Counting objects: 100% (9/9), done.
|
||||
remote: Compressing objects: 100% (5/5), done.
|
||||
remote: Total 9 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
Receiving objects: 100% (9/9), done.
|
||||
Resolving deltas: 100% (1/1), done.
|
||||
|
||||
В папке project появился файл main.cpp
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git config user.name 'BOB (FonovAD)'
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git config user.email 'fonovad@mpei.ru'
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git log --stat
|
||||
commit 23bf55b7deae6431b3923b87827251bdc4fcab85 (HEAD -> main)
|
||||
Author: BOB (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 11:40:21 2023 +0300
|
||||
|
||||
bob`s commit
|
||||
|
||||
main.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
commit fb1c2170039ff464c2f689a712738532a0561765 (origin/main, origin/HEAD)
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:22:48 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
main.cpp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
commit 4e0ecf82b57d65e924181ecb02c75e61c7a0dc4f
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 10:16:45 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git push
|
||||
Enumerating objects: 5, done.
|
||||
Counting objects: 100% (5/5), done.
|
||||
Delta compression using up to 8 threads
|
||||
Compressing objects: 100% (2/2), done.
|
||||
Writing objects: 100% (3/3), 324 bytes | 324.00 KiB/s, done.
|
||||
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
remote: . Processing 1 references
|
||||
remote: Processed 1 references in total
|
||||
To uit.mpei.ru:Fonov_Alexandr/cs-lab02.git
|
||||
fb1c217..23bf55b main -> main
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git fetch
|
||||
remote: Enumerating objects: 5, done.
|
||||
remote: Counting objects: 100% (5/5), done.
|
||||
remote: Compressing objects: 100% (2/2), done.
|
||||
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
Unpacking objects: 100% (3/3), 304 bytes | 101.00 KiB/s, done.
|
||||
From uit.mpei.ru:Fonov_Alexandr/cs-lab02
|
||||
fb1c217..23bf55b main -> origin/main
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git log --oneline --decorate --all --graph
|
||||
|
||||
* 23bf55b (origin/main) bob`s commit
|
||||
* fb1c217 (HEAD -> main) ...
|
||||
* 4e0ecf8 ...
|
||||
* 7fe833c code: заготовка программы
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git pull --ff-only
|
||||
|
||||
Updating fb1c217..23bf55b
|
||||
Fast-forward
|
||||
main.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
18. Добавление на машину Alice деления:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project % git add main.cpp
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project % git commit -m 'add division'
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git push
|
||||
Enumerating objects: 5, done.
|
||||
Counting objects: 100% (5/5), done.
|
||||
Delta compression using up to 8 threads
|
||||
Compressing objects: 100% (2/2), done.
|
||||
Writing objects: 100% (3/3), 315 bytes | 315.00 KiB/s, done.
|
||||
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
remote: . Processing 1 references
|
||||
remote: Processed 1 references in total
|
||||
To uit.mpei.ru:Fonov_Alexandr/cs-lab02.git
|
||||
23bf55b..1602e9b main -> main
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git fetch
|
||||
remote: Enumerating objects: 5, done.
|
||||
remote: Counting objects: 100% (5/5), done.
|
||||
remote: Compressing objects: 100% (2/2), done.
|
||||
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
|
||||
Unpacking objects: 100% (3/3), 295 bytes | 98.00 KiB/s, done.
|
||||
From uit.mpei.ru:Fonov_Alexandr/cs-lab02
|
||||
23bf55b..1602e9b main -> origin/main
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git pull --ff-only
|
||||
|
||||
Updating 23bf55b..1602e9b
|
||||
Fast-forward
|
||||
main.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
|
||||
19. Конфликт
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git push
|
||||
To uit.mpei.ru:Fonov_Alexandr/cs-lab02.git
|
||||
! [rejected] main -> main (fetch first)
|
||||
error: failed to push some refs to 'uit.mpei.ru:Fonov_Alexandr/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.
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project % git log --stat
|
||||
commit 6fd9ced1dfbbb9a45fa8d40def9860632cb727a5 (HEAD -> main)
|
||||
Author: BOB (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 11:56:18 2023 +0300
|
||||
|
||||
add min
|
||||
|
||||
main.cpp | 18 ++++++++++++++----
|
||||
1 file changed, 14 insertions(+), 4 deletions(-)
|
||||
|
||||
commit 92fad59ca0ed2d9612793fa5fdb2604548301501
|
||||
Author: BOB (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 11:50:48 2023 +0300
|
||||
|
||||
...
|
||||
|
||||
main.cpp | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
commit 1602e9bddc7e0060cb15d1f70d1c55d0b3ed393f
|
||||
Author: Alice (FonovAD) <fonovad@mpei.ru>
|
||||
Date: Mon Mar 13 11:46:42 2023 +0300
|
||||
|
||||
add division
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git rebase origin/main
|
||||
|
||||
Auto-merging main.cpp
|
||||
CONFLICT (content): Merge conflict in main.cpp
|
||||
error: could not apply 6fd9ced... add min
|
||||
Resolve all conflicts manually, mark them as resolved with
|
||||
"git add/rm <conflicted_files>", then run "git rebase --continue".
|
||||
You can instead skip this commit: run "git rebase --skip".
|
||||
To abort and get back to the state before "git rebase", run "git rebase --abort".
|
||||
Could not apply 6fd9ced... add min
|
||||
|
||||
|
||||
Команда оповещает об ошибке изменения коммита 6fd9ced, т.к он (коммит Боба) основан не на последнем существующем коммите.
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git add main.cpp
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git rebase --continue
|
||||
|
||||
[detached HEAD 5fa6a1b] add min
|
||||
1 file changed, 9 insertions(+)
|
||||
Successfully rebased and updated refs/heads/main.
|
||||
|
||||
|
||||
20.Использование веток:
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git branch double
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git checkout double
|
||||
|
||||
Switched to branch 'double'
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git commit -m 'double'
|
||||
[double c103a7e] double
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git checkout main
|
||||
|
||||
Switched to branch 'main'
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
|
||||
(base) aleksandr@MacBook-Pro-Aleksandr project
|
||||
% git push
|
||||
Everything up-to-date
|
||||
|
||||
|
||||
(base) aleksandr@MBP-Aleksandr project
|
||||
% git merge double
|
||||
Updating c8e9efd..c103a7e
|
||||
Fast-forward
|
||||
main.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
История всех веток:
|
||||
|
||||
(base) aleksandr@MBP-Aleksandr project % git log --oneline --decorate --all --graph
|
||||
* c103a7e (HEAD -> main, double) double
|
||||
* c8e9efd (origin/main) add max
|
||||
* 92fad59 ...
|
||||
* 1602e9b add division
|
||||
* 23bf55b bob`s commit
|
||||
* fb1c217 ...
|
||||
* 4e0ecf8 ...
|
||||
* 7fe833c code: заготовка программы
|
Загрузка…
Ссылка в новой задаче