Git Branching & Merging Assignment

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Fast Forward Scnario#1:


Master
fea1

# Do 3 Commits in Master
# Create one Branch of fea1 from Master
# Do 3 Commits in fea1
# Do merge from MASTER ->fea1
# OBSERVE MERGING OPTIONS
Pattern
- touch XXXXXX.txt;git add .;git commit -m"XXXXXX"

No Fast Forward Scnarion#2:


Master
fea1

# Do 3 Commits in Master
# Create one Branch of fea1 from Master
# Do 3 Commits in fea1
# Do merge with --no-ff option from MASTER ->fea1
# OBSERVE MERGING OPTIONS
Pattern
- touch XXXXXX.txt;git add .;git commit -m"XXXXXX"

Squash Scnario#3:


Master
fea1

# Do 3 Commits in Master
# Create one Branch of fea1 from Master
# Do 3 Commits in fea1
# Do SQUASH with --squash option from MASTER ->fea1
# commit a recieving branch
# OBSERVE MERGING OPTIONS
Pattern
- touch XXXXXX.txt;git add .;git commit -m"XXXXXX"

Squash Scnario#4:


Check out Azure repos -> branch -> branch Polcicy -> Limit merge types

 477  git init
  478  clear
  479  pwd
  480  ls -la
  481  pwd
  482  clear
  483  git init
  484  touch first.txt;git add --all;git commit -m"This is my first commit"
  485  cleatr
  486  clear
  487  git log
  488  git branch -a
  489  git branch -vv
  490  git branch -r
  491  clear
  492  ls
  493  clear
  494  git remote add origin git@ssh.dev.azure.com:v3/rajeshkumarin/scrum-prj3/first
  495  git push origin master
  496  clear
  497  git branch -a
  498  git branch -vv
  499  git push origin master
  500  exit
  501  ls
  502  cd me/
  503  ls
  504  git pull origin main
  505  clear
  506  ls
  507  git checkout main
  508  clear
  509  git branch -r
  510  clear
  511  touch second.txt;git add .;git commit -m"adding second"
  512  git push origin main
  513  clear
  514  ls
  515  touch thrida.txt;git add .;git commit -m"adding third"
  516  git push origin main
  517  history
  681  git clone git@ssh.dev.azure.com:v3/rajeshkumarin/scrum-prj3/first
  682  clear
  683  ls
  684  cd first/
  685  clear
  686  ls
  687  clear
  688  ls
  689  ls
  690  git status
  691  git log --oneline
  692  git fetch origin main
  693  clear
  694  ls
  695  git branch -a
  696  git merge --squash origin/main
  697  ls
  698  git log --oneline
  699  git status
  700  git commit -m"adding last"
  701  git log --oneline
  702  history
  483  git init
  484  touch first.txt;git add --all;git commit -m"This is my first commit"
  485  cleatr
  486  clear
  487  git log
  488  git branch -a
  489  git branch -vv
  490  git branch -r
  491  clear
  492  ls
  493  clear
  494  git remote add origin git@ssh.dev.azure.com:v3/rajeshkumarin/scrum-prj3/first
  495  git push origin master
  496  clear
  497  git branch -a
  498  git branch -vv
  499  git push origin master
  500  exit
  501  ls
  502  git status
  503  touch 1.txt;git add .;git commit -m"1"
  504  touch 1.txt;git add .;git commit -m"2"
  505  touch 1.txt;git add .;git commit -m"3"
  506  git push origin main
  507  ls
  508  git log --oneline
  509  touch 2.txt;git add .;git commit -m"2"
  510  touch 3.txt;git add .;git commit -m"3"
  511  git push origin main
  512  git log --oneline

Recursive Merge Commands

 529  git init
  530  touch file-1.txt;git add .;git commit -m"file-1"
  531  touch file-2.txt;git add .;git commit -m"file-2"
  532  clear
  533  touch file-3.txt;git add .;git commit -m"file-3"
  534  git checkout -b fea1
  535  touch file-4.txt;git add .;git commit -m"file-4"
  536  git checkout master
  537  touch file-5.txt;git add .;git commit -m"file-5"
  538  clear
  539  git checkout fea1
  540  touch file-6.txt;git add .;git commit -m"file-6"
  541  touch file-7.txt;git add .;git commit -m"file-7"
  542  git checkout master
  543  clear
  544  touch file-8.txt;git add .;git commit -m"file-8"
  545  cleat
  546  clear
  547  git log --oneline
  548  gitk
  549  git checkout fea1
  550  gitk
  551  clear
  552  git checkout master
  553  git merge fea1
  554  git log --oneline
  555  clear
  556  history

Merge Conflict Resolve commands

 559  git branch -a
  560  git merge fea1
  561  git status
  562  clear
  563  ls
  564  vi code.txt
  565  git add .;git commit -m"code commit"
  566  git checkout fea1
  567  clear
  568  ls
  569  vi code.txt
  570  git add .;git commit -m"code commit fea11"
  571  clear
  572  git log --oneline
  573  git checkout master]
  574  git log --oneline
  575  clear
  576  git checkout master
  577  git log --oneline
  578  git merge fea1
  579  git status
  580  vi code.txt
  581  git add .
  582  git commit -m"conf resolve"
  583  clear
  584  git log --oneline
  585  git merge fea1
  586  clear
  587  history

1 – Create a Scanario of Recursive merge and Rebase and see a Graph

2 – Create a Scanario of file conflict of same file – same line – 2 diff branch and merge and resolve a conflict manually.

3 – Create Scanario in which you have multiple commits on FEA branch but same file and CHERRY Pick with Master

Working with Feature git workflow

  • Create a repo in azure repo
  • First commit
  • Create a branch
  • Clone it
  • Do a modification in Branch
  • push the branch
  • Crearte a pull Requst
  • Review and Merge

Working with git workflow of gitflow

$ git flow init

Offline Assignment