Git Delete Branches kodekloud

Ticker

6/recent/ticker-posts

Git Delete Branches kodekloud

Question : Nautilus developers are actively working on one of the project repositories, /usr/src/kodekloudrepos/games. They were doing some testing and created few test branches, now they want to clean those test branches. Below are the requirements that have been shared with the DevOps team:

On Storage server in Stratos DC delete a branch named xfusioncorp_apps from /usr/src/kodekloudrepos/apps git repo. 


Solution:  

1. At first login on to the storage server  & switch to the 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:IxwAD3ZVWxJeoVZGlhqWNAp/2Waue9JvaV7Hz6hyyfg.

ECDSA key fingerprint is MD5:87:7c:77:5f:04:db:fa:a3:35:82:e6:d9:d4:f0:1c:35.

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 the Git repo folder path & check git status 

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

[root@ststor01 apps]#

[root@ststor01 apps]#  git status

On branch xfusioncorp_apps

nothing to commit, working tree clean

[root@ststor01 apps]#

3. Check existing branches and which one is default before deleting 

[root@ststor01 apps]# git branch -a

  master

* xfusioncorp_apps

  remotes/origin/master

[root@ststor01 apps]#

4. Checkout to any other branch or master to change default branch

[root@ststor01 apps]# git checkout master

Switched to branch 'master'

Your branch is up to date with 'origin/master'.

[root@ststor01 apps]#

5. Delete the branch as per your task

[root@ststor01 apps]# git branch --delete xfusioncorp_apps

Deleted branch xfusioncorp_apps (was d5bdc01).

[root@ststor01 apps]#

6. Verify the branches 

[root@ststor01 apps]# git branch -a

* master

  remotes/origin/master

[root@ststor01 apps]#

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
                    

                Happy Learning!!!!









Post a Comment

0 Comments

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user