Отчет по лабораторной работе №2 “Система контроля версий Git”
Выполнил: Снегура Д. С.
Группа: А-02-23
Проверил:
Примечание: работа выполнялась на Windows.
1. Создал на рабочем столе каталог lab02 и запустил в нем Git Bash , приглашение:
2. Создал каталоги Алисы и Боба, создал каталог "project", изучил команду "cd" в процессе:
u113-18@PROG-03 MINGW32 ~/Desktop/laba02
$ mkdir alice
u113-18@PROG-03 MINGW32 ~/Desktop/laba02
$ mkdir bob
Переход на каталог алисы
u113-18@PROG-03 MINGW32 ~/Desktop/laba02
$ cd alice
Создание каталога project, переход в каталог, переход на уровень выше, возвращение в каталог
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice
$ mkdir project
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice
$ cd project
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project
$ cd ..
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice
$ cd project
3. Просмотрел файлы в рабочем каталоге можно командой "ls" --- пусто:
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project
$ ls
4. Инициализировал репозитарий:
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project
$ git init
Initialized empty Git repository in C:/Users/u113-18/Desktop/laba02/alice/projec
t/.git/
Просмотр папки, где сделано git init
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ ls -A
.git/
5. Настраиваем репозитарий Алисы, чтобы коммиты были от ее имени
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git config user.name 'Alice (SneguraDS)'
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git config user.email 'SneguraDS@mpei.ru'
6. Занесение файлов под контроль версий
Смотрим состояние рабочей копии
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add ..." to include in what will be committed)
main.cpp
obj/
project.cbp
nothing added to commit but untracked files present (use "git add" to track)
Заносим под Git файл main.cpp
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git add main.cpp
Смотрим состояние рабочей копии снова: в Changes to be committed появился наш файл main.cpp, а из Untracked files он пропадает.
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git status
On branch master
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)
obj/
project.cbp
7. Выполняем коммит с файлом main.cpp и коротким сообщением
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git commit -m 'code: заготовка программы'
[master (root-commit) dfa8efd] code: заготовка программы
1 file changed, 9 insertions(+)
create mode 100644 main.cpp
8. Добавление файла project.cbp в индекс и коммит с ним
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git add project.cbp
warning: LF will be replaced by CRLF in project.cbp.
The file will have its original line endings in your working directory
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git commit -m 'build: добавлен файл проекта'
[master 4ef633f] build: добавлен файл проекта
1 file changed, 40 insertions(+)
create mode 100644 project.cbp
9. Просмотр состояния репозитария
Когда мы добавляем новый файл, он появляется в структуре, а когда изменяем существующий, то происходят изменения в нем, например, сейчас каталог project
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git status
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)
obj/
nothing added to commit but untracked files present (use "git add" to track)
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: main.cpp
Untracked files:
(use "git add ..." to include in what will be committed)
obj/
project.depend
no changes added to commit (use "git add" and/or "git commit -a")
1 способ создания коммитов с изменениями
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git add main.cpp
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git commit -m "..."
[master 6f1e734] ...
1 file changed, 3 insertions(+), 1 deletion(-)
2 способ создания коммитов с изменениями
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git add -u
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git commit -m "..."
[master 6f1e734] ...
1 file changed, 3 insertions(+), 1 deletion
3 способ создания коммитов с изменениями
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git commit -a -m "..."
[master a3519c8] ...
1 file changed, 1 insertion(+), 1 deletion(-)
10. Просмотр состояния
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git status
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)
.gitignore
obj/
project.depend
nothing added to commit but untracked files present (use "git add" to track)
11. Просмотр состояния
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git status
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)
.gitignore
project.depend
nothing added to commit but untracked files present (use "git add" to track)
12. Внесение под контроль версий
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git add .gitignore
13. Создания коммита с .gitignore
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git commit -m 'git: добавлены файлы в игнор'
[master 073a556] git: добавлены файлы в игнор
1 file changed, 3 insertions(+)
create mode 100644 .gitignore
14. Журнал репозитария, работа с командой git log
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log
commit 073a556544d2f97be0e4be9e8b22c084044397e3 (HEAD -> master)
Author: Alice (SneguraDS)
Date: Mon Mar 11 15:14:55 2024 +0300
git: добавлены файлы в игнор
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
commit 6f1e734fe401ef98ddedc373e86fe548498b76d4
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:45:30 2024 +0300
...
commit 4ef633fb726c019c46c95ccb2a64af3d07090cdb
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:30:39 2024 +0300
build: добавлен файл проекта
commit dfa8efdecd3b7b2d0fe069cbaf681a6e39bb516d
Author: Alice (SneguraDS)
Показывает файлы, измененные в коммитах
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --stat
commit 073a556544d2f97be0e4be9e8b22c084044397e3 (HEAD -> master)
Author: Alice (SneguraDS)
Date: Mon Mar 11 15:14:55 2024 +0300
git: добавлены файлы в игнор
.gitignore | 3 +++
1 file changed, 3 insertions(+)
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 6f1e734fe401ef98ddedc373e86fe548498b76d4
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:45:30 2024 +0300
...
main.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Показывает коммиты компактно, а также показывает ссылки, концы веток и тэги
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --oneline --decorate
073a556 (HEAD -> master) git: добавлены файлы в игнор
a3519c8 ...
6f1e734 ...
4ef633f build: добавлен файл проекта
dfa8efd code: заготовка программы
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ q
bash: q: command not found
Делает то же для всех веток, причем коммиты отображаются в терминале в виде дерева
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log -oneline --decorate --all --graph
fatal: unrecognized argument: -oneline
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ q
bash: q: command not found
Коммиты по теме build
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --grep "build:"
commit 4ef633fb726c019c46c95ccb2a64af3d07090cdb
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:30:39 2024 +0300
build: добавлен файл проекта
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ q
bash: q: command not found
Коммиты, затрагивающие project.cbp
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log -- project.cbp
commit 4ef633fb726c019c46c95ccb2a64af3d07090cdb
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:30:39 2024 +0300
build: добавлен файл проекта
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ q
bash: q: command not found
Просмотр предыдущего коммита
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git show HEAD~1
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
diff --git a/main.cpp b/main.cpp
index 67a6d13..667e85e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,5 +1,4 @@
#include
-
using namespace std;
int main()
@@ -7,5 +6,6 @@ int main()
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
+ cout<<"A + B = "<>a>>b;
+ cout<<"A + B = "<>a>>b;
+ cout<<"A + B = "<>a>>b;
+ cout<<"A + B = "<>a>>b;
+ cout<<"A + B = "<>a>>b;
- cout<<"A + B = "<>a>>b;
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git diff HEAD~2 HEAD
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d85abef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/bin
+/obj
+/*.layout
diff --git a/main.cpp b/main.cpp
index 67a6d13..667e85e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,5 +1,4 @@
#include
-
using namespace std;
int main()
@@ -7,5 +6,6 @@ int main()
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git diff HEAD
diff --git a/main.cpp b/main.cpp
index 667e85e..0050905 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,6 +6,6 @@ int main()
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
- cout<<"A + B = "<>a>>b;
- cout<<"A + B = "<>a>>b;
u113-18@PROG-03 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git diff HEAD~1
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d85abef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/bin
+/obj
+/*.layout
diff --git a/main.cpp b/main.cpp
index 667e85e..0050905 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,6 +6,6 @@ int main()
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
- cout<<"A + B = "<>a>>b;
- cout<<"A + B = "<>a>>b;
- cout<<"A + B = "< master
Загрузка изменений на машине Боба
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git fetch
The authenticity of host 'uit.mpei.ru (10.1.6.13)' can't be established.
ECDSA key fingerprint is SHA256:+MRh1ssS2MjYzxp1zO+xbhzkFjtvbXFwcP0Nuzb7bD8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'uit.mpei.ru,10.1.6.13' (ECDSA) to the list of known hosts.
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), done.
From uit.mpei.ru:SneguraDS/cs-lab02
a3123c5..d4aafd8 master -> origin/master
Продвижение ветки к скачанной версии
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git pull --ff-only
Updating a3123c5..d4aafd8
Fast-forward
main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git log --oneline
d4aafd8 (HEAD -> master, origin/master, origin/HEAD) code : äîáàâëåíèå äåëåíèÿ
a3123c5 ...
53ca194 ...
0652f1a ...
073a556 git: äîáàâëåíû ôàéëû â èãíîð
a3519c8 ...
6f1e734 ...
4ef633f build: äîáàâëåí ôàéë ïðîåêòà
dfa8efd code: çàãîòîâêà ïðîãðàììû
Отправка коммита о печати произведения чисел на сервер
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git add main.cpp
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git commit -m 'code: äîáàâëåíèå ïå÷àòè ìèíèìóìà'
[master 2ac644a] code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
1 file changed, 6 insertions(+)
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git push
To uit.mpei.ru:SneguraDS/cs-lab02.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@uit.mpei.ru:SneguraDS/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.
Получение изменений на машине Боба
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ 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), done.
From uit.mpei.ru:SneguraDS/cs-lab02
d4aafd8..8ffff1b master -> origin/master
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git log
commit 2ac644a70547305d07f2ad1c0ed2c7c6bfb98eb0 (HEAD -> master)
Author: Bob (SneguraDS)
Date: Mon Mar 25 16:31:13 2024 +0300
code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
commit d4aafd88e2cdc9b619809dcbb8597eba99c96042
Author: Alice (SneguraDS)
Date: Mon Mar 25 16:03:22 2024 +0300
code : äîáàâëåíèå äåëåíèÿ
commit a3123c5dbd1ab43c24238ab8a5a5471190066627
Author: Bob (SneguraDS)
Date: Sun Mar 24 22:05:28 2024 +0300
...
commit 53ca19460af4f422d598d591b19e2bddd0ab8eec
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:03:18 2024 +0300
...
commit 0652f1a2c94400135a984a0a2f2b4dab2753ecef
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:02:17 2024 +0300
...
commit 073a556544d2f97be0e4be9e8b22c084044397e3
Author: Alice (SneguraDS)
Date: Mon Mar 11 15:14:55 2024 +0300
git: äîáàâëåíû ôàéëû â èãíîð
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
commit 6f1e734fe401ef98ddedc373e86fe548498b76d4
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:45:30 2024 +0300
...
commit 4ef633fb726c019c46c95ccb2a64af3d07090cdb
Author: Alice (SneguraDS)
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git log --oneline --decorate --all --graph
* 2ac644a (HEAD -> master) code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
| * 8ffff1b (origin/master, origin/HEAD) code: äîáàâëåíèå ïå÷àòè ìàêñèìóìà
|/
* d4aafd8 code : äîáàâëåíèå äåëåíèÿ
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: äîáàâëåíû ôàéëû â èãíîð
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: äîáàâëåí ôàéë ïðîåêòà
* dfa8efd code: çàãîòîâêà ïðîãðàììû
Бобу нужно переместить свой коммит поверх коммита Алисы, то есть поверх origin/main
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git rebase origin/master
First, rewinding head to replay your work on top of it...
Applying: code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
.git/rebase-apply/patch:10: space before tab in indent.
cout<< "min = "<", 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".
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git add main.cpp
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git commit -m ' code: êîä ñ ìàêñèìóìîì è ìèíèìóìîì'
[detached HEAD 49a154a] code: êîä ñ ìàêñèìóìîì è ìèíèìóìîì
1 file changed, 8 insertions(+), 2 deletions(-)
Добавление файла в индекс и продолжение прерванной операции rebase
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git add main.cpp
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git rebase --continue
Applying: code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.
Resolve all conflicts manually, mark them as resolved with
"git add/rm ", 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".
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ cat main.cpp
#include
using namespace std;
int main()
{
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
cout<<"A + B = "<", 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".
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git log --oneline --decorate --all --graph
* 49a154a (HEAD) code: êîä ñ ìàêñèìóìîì è ìèíèìóìîì
* 8ffff1b (origin/master, origin/HEAD) code: äîáàâëåíèå ïå÷àòè ìàêñèìóìà
| * 2ac644a (master) code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
|/
* d4aafd8 code : äîáàâëåíèå äåëåíèÿ
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: äîáàâëåíû ôàéëû â èãíîð
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: äîáàâëåí ôàéë ïðîåêòà
* dfa8efd code: çàãîòîâêà ïðîãðàììû
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git rebase --abort
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git log --oneline --decorate --all --graph
* 2ac644a (HEAD -> master) code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
| * 8ffff1b (origin/master, origin/HEAD) code: äîáàâëåíèå ïå÷àòè ìàêñèìóìà
|/
* d4aafd8 code : äîáàâëåíèå äåëåíèÿ
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: äîáàâëåíû ôàéëû â èãíîð
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: äîáàâëåí ôàéë ïðîåêòà
* dfa8efd code: çàãîòîâêà ïðîãðàììû
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git push
To uit.mpei.ru:SneguraDS/cs-lab02.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@uit.mpei.ru:SneguraDS/cs-lab02.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git pull
Auto-merging main.cpp
CONFLICT (content): Merge conflict in main.cpp
Automatic merge failed; fix conflicts and then commit the result.
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|MERGING)
$ cat main.cpp
#include
using namespace std;
int main()
{
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
cout<<"A + B = "<>a>>b;
cout<<"A + B = "<", 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".
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git add main.cpp
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master|REBASE 1/1)
$ git rebase --continue
Applying: code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git log --oneline --decorate --all --graph
* 3dc0d94 (HEAD -> master) code: äîáàâëåíèå ïå÷àòè ìèíèìóìà
* 8ffff1b (origin/master, origin/HEAD) code: äîáàâëåíèå ïå÷àòè ìàêñèìóìà
* d4aafd8 code : äîáàâëåíèå äåëåíèÿ
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: äîáàâëåíû ôàéëû â èãíîð
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: äîáàâëåí ôàéë ïðîåêòà
* dfa8efd code: çàãîòîâêà ïðîãðàììû
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/bob/project (master)
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 433 bytes | 216.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: . Processing 1 references
remote: Processed 1 references in total
To uit.mpei.ru:SneguraDS/cs-lab02.git
8ffff1b..3dc0d94 master -> master
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ 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), done.
From http://uit.mpei.ru/git/SneguraDS/cs-lab02
* [new branch] master -> origin/master
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log
commit 6060d4ae7610c813e36c39c960f2d5d1e2b9fc4a (HEAD -> master)
Author: Alice (SneguraDS)
Date: Sun Mar 24 22:44:18 2024 +0300
...
commit 53ca19460af4f422d598d591b19e2bddd0ab8eec
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:03:18 2024 +0300
...
commit 0652f1a2c94400135a984a0a2f2b4dab2753ecef
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:02:17 2024 +0300
...
commit 073a556544d2f97be0e4be9e8b22c084044397e3
Author: Alice (SneguraDS)
Date: Mon Mar 11 15:14:55 2024 +0300
git: äîáàâëåíû ôàéëû â èãíîð
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
commit 6f1e734fe401ef98ddedc373e86fe548498b76d4
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:45:30 2024 +0300
: 2 [sig] bash 1592! sigpacket::process: Suppressing signal 18cess (pid 2732)
Date: Mon Mar 11 16:03:18 2024 +0300
...
commit 0652f1a2c94400135a984a0a2f2b4dab2753ecef
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:02:17 2024 +0300
...
commit 073a556544d2f97be0e4be9e8b22c084044397e3
Author: Alice (SneguraDS)
Date: Mon Mar 11 15:14:55 2024 +0300
git: äîáàâëåíû ôàéëû â èãíîð
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
commit 6f1e734fe401ef98ddedc373e86fe548498b76d4
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:45:30 2024 +0300
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --all
commit 6060d4ae7610c813e36c39c960f2d5d1e2b9fc4a (HEAD -> master)
Author: Alice (SneguraDS)
Date: Sun Mar 24 22:44:18 2024 +0300
...
commit a3123c5dbd1ab43c24238ab8a5a5471190066627 (origin/master)
Author: Bob (SneguraDS)
Date: Sun Mar 24 22:05:28 2024 +0300
...
commit 53ca19460af4f422d598d591b19e2bddd0ab8eec
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:03:18 2024 +0300
...
commit 0652f1a2c94400135a984a0a2f2b4dab2753ecef
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:02:17 2024 +0300
...
commit 073a556544d2f97be0e4be9e8b22c084044397e3
Author: Alice (SneguraDS)
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --all --oneline
6060d4a (HEAD -> master) ...
a3123c5 (origin/master) ...
53ca194 ...
0652f1a ...
073a556 git: äîáàâëåíû ôàéëû â èãíîð
a3519c8 ...
6f1e734 ...
4ef633f build: äîáàâëåí ôàéë ïðîåêòà
dfa8efd code: çàãîòîâêà ïðîãðàììû
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git fetch
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --oneline --decorate --all --graph
* 6060d4a (HEAD -> master) ...
| * a3123c5 (origin/master) ...
|/
* 53ca194 ...
* 0652f1a ...
* 073a556 git: äîáàâëåíû ôàéëû â èãíîð
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: äîáàâëåí ôàéë ïðîåêòà
* dfa8efd code: çàãîòîâêà ïðîãðàììû
Алиса
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git log --oneline --all
a3123c5 (origin/master) ...
53ca194 (HEAD -> master) ...
0652f1a ...
073a556 git: äîáàâëåíû ôàéëû â èãíîð
a3519c8 ...
6f1e734 ...
4ef633f build: äîáàâëåí ôàéë ïðîåêòà
dfa8efd code: çàãîòîâêà ïðîãðàììû
Продвижение ветки алисы
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ git pull origin master
From http://uit.mpei.ru/git/SneguraDS/cs-lab02
* branch master -> FETCH_HEAD
Updating 53ca194..a3123c5
Fast-forward
main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
u113-18@PROG-09 MINGW32 ~/Desktop/laba02/alice/project (master)
$ cat main.cpp
#include
using namespace std;
int main()
{
cout << "Enter A and B: ";
int a,b;
cin>>a>>b;
cout<<"A + B = "<..." 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)
main.exe
main.o
project.depend
no changes added to commit (use "git add" and/or "git commit -a")
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git branch double
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git checkout double
Switched to branch 'double'
M main.cpp
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (double)
$ git add main.cpp
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (double)
$ git commit -m 'code: изменение типа переменных a, b на double'
[double 51a33ab] code: изменение типа переменных a, b на double
1 file changed, 9 insertions(+), 3 deletions(-)
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (double)
$ git checkout master
Switched to branch 'master'
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git push origin master
warning: auto-detection of host provider took too long (>2000ms)
warning: see https://aka.ms/gcm/autodetect for more information.
warning: auto-detection of host provider took too long (>2000ms)
warning: see https://aka.ms/gcm/autodetect for more information.
To http://uit.mpei.ru/git/SneguraDS/cs-lab02
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'http://uit.mpei.ru/git/SneguraDS/cs-lab02'
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.
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git log --oneline
8ffff1b (HEAD -> master, origin/master) code: добавление печати максимума
d4aafd8 code : добавление деления
a3123c5 ...
53ca194 ...
0652f1a ...
073a556 git: добавлены файлы в игнор
a3519c8 ...
6f1e734 ...
4ef633f build: добавлен файл проекта
dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git log --oneline --decorate --all --graph
* 51a33ab (double) code: изменение типа переменных a, b на double
* 8ffff1b (HEAD -> master, origin/master) code: добавление печати максимума
* d4aafd8 code : добавление деления
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: добавлены файлы в игнор
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: добавлен файл проекта
* dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git push origin master
To http://uit.mpei.ru/git/SneguraDS/cs-lab02
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'http://uit.mpei.ru/git/SneguraDS/cs-lab02'
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.
Отправка на сервер
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git push origin master
To http://uit.mpei.ru/git/SneguraDS/cs-lab02
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'http://uit.mpei.ru/git/SneguraDS/cs-lab02'
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.
Загрузка изменений
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ 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), 413 bytes | 19.00 KiB/s, done.
From http://uit.mpei.ru/git/SneguraDS/cs-lab02
8ffff1b..3dc0d94 master -> origin/master
Продвижение ветки
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git pull origin master
From http://uit.mpei.ru/git/SneguraDS/cs-lab02
* branch master -> FETCH_HEAD
Updating 8ffff1b..3dc0d94
Fast-forward
main.cpp | 7 +++++++
1 file changed, 7 insertions(+)
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git log --oneline --decorate --all --graph
* 51a33ab (double) code: изменение типа переменных a, b на double
| * 3dc0d94 (HEAD -> master, origin/master) code: добавление печати минимума
|/
* 8ffff1b code: добавление печати максимума
* d4aafd8 code : добавление деления
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: добавлены файлы в игнор
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: добавлен файл проекта
* dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git merge double
Auto-merging main.cpp
CONFLICT (content): Merge conflict in main.cpp
Automatic merge failed; fix conflicts and then commit the result.
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git log --oneline --decorate --all --graph
* 51a33ab (double) code: изменение типа переменных a, b на double
| * 3dc0d94 (HEAD -> master, origin/master) code: добавление печати минимума
|/
* 8ffff1b code: добавление печати максимума
* d4aafd8 code : добавление деления
* a3123c5 ...
* 53ca194 ...
* 0652f1a ...
* 073a556 git: добавлены файлы в игнор
* a3519c8 ...
* 6f1e734 ...
* 4ef633f build: добавлен файл проекта
* dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git merge double
error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm '
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git pull --ff -only
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm '
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git log --oneline --decorate
3dc0d94 (HEAD -> master, origin/master) code: добавление печати минимума
8ffff1b code: добавление печати максимума
d4aafd8 code : добавление деления
a3123c5 ...
53ca194 ...
0652f1a ...
073a556 git: добавлены файлы в игнор
a3519c8 ...
6f1e734 ...
4ef633f build: добавлен файл проекта
dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git checkout double
error: you need to resolve your current index first
main.cpp: needs merge
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git merge --continue
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm '
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
U main.cpp
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add ..." to mark resolution)
both modified: main.cpp
Untracked files:
(use "git add ..." to include in what will be committed)
main.exe
main.o
project.depend
no changes added to commit (use "git add" and/or "git commit -a")
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git log
commit 3dc0d946b227e44b80abaa7e9f882e25fd8158d6 (HEAD -> master, origin/master)
Author: Bob (SneguraDS)
Date: Mon Mar 25 16:31:13 2024 +0300
code: добавление печати минимума
commit 8ffff1b4fc1a2da163a73aa7ef6fa17d2a8a9144
Author: Alice (SneguraDS)
Date: Mon Mar 25 16:27:38 2024 +0300
code: добавление печати максимума
commit d4aafd88e2cdc9b619809dcbb8597eba99c96042
Author: Alice (SneguraDS)
Date: Mon Mar 25 16:03:22 2024 +0300
code : добавление деления
commit a3123c5dbd1ab43c24238ab8a5a5471190066627
Author: Bob (SneguraDS)
Date: Sun Mar 24 22:05:28 2024 +0300
...
commit 53ca19460af4f422d598d591b19e2bddd0ab8eec
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:03:18 2024 +0300
...
commit 0652f1a2c94400135a984a0a2f2b4dab2753ecef
Author: Alice (SneguraDS)
Date: Mon Mar 11 16:02:17 2024 +0300
...
commit 073a556544d2f97be0e4be9e8b22c084044397e3
Author: Alice (SneguraDS)
Date: Mon Mar 11 15:14:55 2024 +0300
git: добавлены файлы в игнор
commit a3519c8d5112eda5381cda4fc7c7b2d1820fadf6
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:59:39 2024 +0300
...
commit 6f1e734fe401ef98ddedc373e86fe548498b76d4
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:45:30 2024 +0300
...
commit 4ef633fb726c019c46c95ccb2a64af3d07090cdb
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:30:39 2024 +0300
build: добавлен файл проекта
commit dfa8efdecd3b7b2d0fe069cbaf681a6e39bb516d
Author: Alice (SneguraDS)
Date: Mon Mar 11 14:25:53 2024 +0300
code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git add main.cpp
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git status
On branch master
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
modified: main.cpp
Untracked files:
(use "git add ..." to include in what will be committed)
main.exe
main.o
project.depend
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master|MERGING)
$ git merge --continue
[master e83939b] Merge branch 'double'
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (master)
$ git log --oneline --decorate
e83939b (HEAD -> master) Merge branch 'double'
51a33ab (double) code: изменение типа переменных a, b на double
3dc0d94 (origin/master) code: добавление печати минимума
8ffff1b code: добавление печати максимума
d4aafd8 code : добавление деления
a3123c5 ...
53ca194 ...
0652f1a ...
073a556 git: добавлены файлы в игнор
a3519c8 ...
6f1e734 ...
4ef633f build: добавлен файл проекта
dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (double)
$ git log --oneline --decorate
51a33ab (HEAD -> double) code: изменение типа переменных a, b на double
8ffff1b code: добавление печати максимума
d4aafd8 code : добавление деления
a3123c5 ...
53ca194 ...
0652f1a ...
073a556 git: добавлены файлы в игнор
a3519c8 ...
6f1e734 ...
4ef633f build: добавлен файл проекта
dfa8efd code: заготовка программы
Дана@WIN-6PSIT1UE2JS MINGW64 ~/Desktop/laba02/alice/project (double)
$ git checkout master
Switched to branch 'master'