yashinomi / sysdev2020_advanced

0 stars 0 forks source link

Class 3. Exercise 7. log #12

Closed yashinomi closed 4 years ago

yashinomi commented 4 years ago

リベース体験

yashinomi commented 4 years ago

ブランチを作る。

$ git checkout -b br-b
Switched to a new branch 'br-b'
yashinomi commented 4 years ago

いくつかコミットする。

$ echo hoge >> hoge.txt
$ git add hoge.txt
$ git commit -m "add more hoge"
[br-b 0cf623e] add more hoge
 1 file changed, 1 insertion(+)
$
$  echo fuga >> fuga.txt
$ git add fuga.txt 
$ git commit -m "add more fuga"
[br-b 28ef841] add more fuga
 1 file changed, 1 insertion(+)
yashinomi commented 4 years ago

master に戻る。

git checkout master
yashinomi commented 4 years ago

コミットする。

$ echo fugafuga >> fuga.txt
$ git add fuga.txt 
$ git commit -m "add more fugafuga"
[master 5894ba3] add more fugafuga
 1 file changed, 1 insertion(+)
yashinomi commented 4 years ago

br-bに戻る。

$ git checkout br-b
Switched to branch 'br-b'
yashinomi commented 4 years ago

リベースしたらコンフリクトした。一応想定内。

$ git rebase master
Auto-merging fuga.txt
CONFLICT (content): Merge conflict in fuga.txt
error: could not apply 28ef841... add more fuga
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 28ef841... add more fuga

コンフリクトを解消して、続行。

$ vim fuga.txt
$ git add fuga.txt
$ git commit -m "fix conlict" 
[detached HEAD e5729f1] fix conlict
 1 file changed, 1 insertion(+)

あれ detached HEAD???

yashinomi commented 4 years ago

続行を忘れていた。

$ git rebase --continue
Successfully rebased and updated refs/heads/br-b.
yashinomi commented 4 years ago
$ git log --graph --all --decorate=full
* commit e5729f102423ba7e702cbf7c6c563508bcb8c1b7 (HEAD -> refs/heads/br-b)
| Author:
| Date:   Fri Oct 23 16:29:36 2020 +0900
| 
|     fix conlict
| 
* commit 9423a7b3a7d6997532c43b823d58c168786cc823
| Author:
| Date:   Fri Oct 23 16:21:39 2020 +0900
| 
|     add more hoge
| 
* commit 5894ba3f27a62ab4cbb6660be2e54a77a7b561f6 (refs/heads/master)
| Author: 
| Date:   Fri Oct 23 16:25:36 2020 +0900
| 
|     add more fugafuga
|   
*   commit c7a420abe4b3d34b829d755c4c18b34cefc60783
|\  Merge: bd26177 9e6d64d
| | Author:
| | Date:   Fri Oct 23 16:08:39 2020 +0900
| | 
| |     fix conflict