Git Challenge VI

 

Git Challenge VI

1. Create a temporary branch with the name of **newBranch**.

Solution

-    git branch newBranch


2. Switch to that branch.

Solution

-    git checkout newBranch


3. Use the `touch` command to create an empty **README.md** file in the root directory of your project.

Solution

-    touch README.md


4. Add that new **README.md** file to the staging area.

Solution

-    git add README.md


5. Commit that change with an appropriate message.

Solution

-    git commit -m "Adding README.md"

6.Checkout the **main** branch.

Solution

-    git checkout main


7. Delete **newBranch** — but Git won’t let you delete this branch in its current state. Why?


Solution

First, try the following:

-    git branch -d newBranch

Git responds with: error: The branch 'newBranch' is not fully merged.
If you are sure you want to delete it, run 'git branch -D newBranch'.


8. Follow the suggestion that Git gives you to see if you can delete this branch.

Solution

-    git branch -D newBranch








Comments

Popular posts from this blog

HOW TO GET FREE WEB HOSTING FOR WEBSITE BY FAHIM KHAN

Demystifying Java: Your Journey to Coding

How TikTok Algorithms Works?