Git Merge Branches Kodekloud

 


Question: The Nautilus application development team has been working on a project repository /opt/cluster.git. This repo is cloned at /usr/src/kodekloudrepos on storage server in Stratos DC. They recently shared the following requirements with DevOps team:

a. Create a new branch xfusion in /usr/src/kodekloudrepos/cluster repo from master and copy the /tmp/index.html file (on storage server itself). Add/commit this file in the new branch and merge back that branch to the master branch. Finally, push the changes to origin for both of the branches.

Solution:

ssh into storage server

ssh natasha@ststor01

Login as root

sudo su

Go to repository

cd /usr/src/kodekloudrepos/cluster

Create new branch

git checkout -b xfusion

Copy index.html

 cp /tmp/index.html .

Add, commit, merge, push

git add .

git commit -m "added index.html"

git checkout master

git merge xfusion

git push origin xfusion

git push origin master


Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment