Branches are one of the most powerful features in Git. A branch represents an independent line of development. By using branches, developers can work on new features, experiment, or fix bugs in isolation without modifying the main codebase (typically the master or main branch).
In a DevOps workflow:
master via a pull request, allowing for automated testing and peer code reviews.This guide outlines the steps to SSH into the Storage Server (ststor01), navigate to the specified repository under /usr/src/kodekloudrepos/, switch to the master branch, and create a new feature branch named xfusioncorp_media.
ststor01)natashajump_host)/usr/src/kodekloudrepos/media (or the repository assigned in your lab)xfusioncorp_mediamasterFrom the Jump Host, establish an SSH session to the Storage Server (ststor01) using the natasha user credentials:
ssh natasha@ststor01
Navigate to the path of the target repository:
cd /usr/src/kodekloudrepos/media
(Note: Replace media with the specific repository directory assigned to you in the task description.)
If you encounter git warnings about “dubious ownership” because the files are owned by a different user, configure Git to trust this repository directory globally:
git config --global --add safe.directory /usr/src/kodekloudrepos/media
If you face permission issues writing to the git repository configuration or directory, prefix your git commands with sudo (e.g., sudo git checkout master).
Switch to the base branch (master) before branching off, ensuring you have the latest baseline:
git checkout master
Verify your current active branch:
git branch
Expected output snippet:
* master
Create and switch to the new feature branch xfusioncorp_media using the checkout command:
git checkout -b xfusioncorp_media
Expected output snippet:
Switched to a new branch 'xfusioncorp_media'
List all local branches to confirm that the new branch exists and is currently active (marked with an asterisk *):
git branch
Expected output snippet:
master
* xfusioncorp_media
Verify the branch status inside the repository:
git status
The output should confirm you are on the xfusioncorp_media branch with no commits or untracked changes:
On branch xfusioncorp_media
nothing to commit, working tree clean
Log out of the Storage Server to return to the Jump Host:
exit