lunes, 7 de diciembre de 2020

GIT Demystifying part 12, Branch & Merge

 GIT Demystifying part 12

Branch & Merge

Create a Y tree
git merge branch
git diff
git diff --ours
git diff --theirs
git diff --base
git checkout --conflict=diff3 filename
git log --oneline --all --decorate --graph
git log --oneline HEAD...MERGE_HEAD
git log --cc -p -1
git merge --abort

Create a Y tree

$ git init
Initialized empty Git repository in C:/Users/bext/Documents/workspaceSTS448/gitLab01/.git/

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ vi file1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git commit -am "c1"
On branch master

Initial commit

Untracked files:
        file1

nothing added to commit but untracked files present

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git add f*
warning: LF will be replaced by CRLF in file1.
The file will have its original line endings in your working directory

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git commit -am "c1"
[master (root-commit) 2ca5b4c] c1
 1 file changed, 2 insertions(+)
 create mode 100644 file1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ logg
* 2ca5b4c (HEAD -> master) c1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ vi file1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git commit -am "c2"
warning: LF will be replaced by CRLF in file1.
The file will have its original line endings in your working directory
[master 44c4ada] c2
 1 file changed, 1 insertion(+)

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ logg
* 44c4ada (HEAD -> master) c2
* 2ca5b4c c1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git branch branch_01

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ logg
* 44c4ada (HEAD -> master, branch_01) c2
* 2ca5b4c c1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ ls
file1  gitLab01.iml  src/

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ cat file1
file1
A
B

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git checkout branch_01
Switched to branch 'branch_01'

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ logg
* 44c4ada (HEAD -> branch_01, master) c2
* 2ca5b4c c1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ vi file1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ vi file2

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ cat filea
cat: filea: No such file or directory

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ cat file1
file1
A
B
file2:B

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ cat file2
file2
B

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ git add f*
warning: LF will be replaced by CRLF in file1.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in file2.
The file will have its original line endings in your working directory

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ git commit -m "c3"
[branch_01 6242885] c3
 2 files changed, 3 insertions(+)
 create mode 100644 file2

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ logg
* 6242885 (HEAD -> branch_01) c3
* 44c4ada (master) c2
* 2ca5b4c c1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (branch_01)
$ git checkout master
Switched to branch 'master'

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ vi file1

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ vi file2

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git add f*
warning: LF will be replaced by CRLF in file2.
The file will have its original line endings in your working directory

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ git commit -m "c4"
[master 0d05b4a] c4
 2 files changed, 3 insertions(+)
 create mode 100644 file2

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ cat file1
file1
A
B
file2:A

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ cat file2
file2
A

bext@DESKTOP-NLF0058 MINGW64 ~/Documents/workspaceSTS448/gitLab01 (master)
$ logg
* 0d05b4a (HEAD -> master) c4
| * 6242885 (branch_01) c3
|/
* 44c4ada c2
* 2ca5b4c c1

git merge branch
git diff
git diff --ours
git diff --theirs
git diff --base



git checkout --conflict=diff3 filename
git log --oneline --all --decorate --graph
git log --oneline HEAD...MERGE_HEAD
git log --cc -p -1



git merge --abort

  


git merge branch_01, again


Concrete the merge by commiting



eot



No hay comentarios:

Publicar un comentario