Git Create Branches

Ticker

6/recent/ticker-posts

Git Create Branches

Question:  Nautilus developers are actively working on one of the project repositories, /usr/src/kodekloudrepos/official. They recently decided to implement some new features in the application, and they want to maintain those new changes in a separate branch. Below are the requirements that have been shared with the DevOps team:

On Storage server in Stratos DC create a new branch xfusioncorp_official from master branch in /usr/src/kodekloudrepos/official git repo.

Please do not try to make any changes in code.

Please Note :-  Perform the below commands based on your question server,  user name & other details that might differ. So please read the task carefully before executing it.
 All the Best 👍

Solution:   

1. Login on storage server  & Switch Root user    

thor@jump_host ~$ ssh natasha@ststor01

The authenticity of host 'ststor01 (172.16.238.15)' can't be established.

ECDSA key fingerprint is SHA256:n3JNs9ck2GulrVCAS9VfYwuMlTaCIV5NZi3RJK10pUg.

ECDSA key fingerprint is MD5:45:19:c4:f0:1e:1e:77:bc:c0:43:b6:e9:0a:29:fa:46.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'ststor01,172.16.238.15' (ECDSA) to the list of known hosts.

natasha@ststor01's password:

[natasha@ststor01 ~]$ sudo su -

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for natasha:

[root@ststor01 ~]#

 2. go to project repositories given in the task

[root@ststor01 ~]# cd /usr/src/kodekloudrepos/official

[root@ststor01 official]# ll

total 8

-rw-r--r-- 1 root root 34 Jul 28 05:18 data.txt

-rw-r--r-- 1 root root 34 Jul 28 05:18 info.txt

[root@ststor01 official]#

3. Checkout  to master, since its need to create a new branch from master

[root@ststor01 official]# git checkout master

Switched to branch 'master'

[root@ststor01 official]#

  
4Create a new branch from master as per the task

[root@ststor01 official]# git checkout -b xfusioncorp_official

Switched to a new branch 'xfusioncorp_official'

[root@ststor01 official]#

[root@ststor01 official]# git status

# On branch xfusioncorp_official

nothing to commit, working directory clean

[root@ststor01 official]#


5. validate the task by running
    

[root@ststor01 official]# git branch -a

  kodekloud_official

  master

* xfusioncorp_official

  remotes/origin/master

[root@ststor01 official]#


6. Click on Finish & Confirm to complete the task successfully

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge





Post a Comment

0 Comments

Latest Posts

VPC Variable Setup Using Terraform Kodekloud Engineer Task Success