Git Exercises

Ques.3- Create a new file called `README.md` and add some text to it

Ans- To create a new file called `README.md` and add some text to it using Git, follow these steps:


1. Open your terminal or command prompt.

2. Navigate to the Git repository where you want to create the `README.md` file. You can use the `cd` command to change directories. For example, if your repository is located on your desktop, you might use:

bash
cd ~/Desktop/repository-name


3. Create the `README.md` file using any text editor or terminal command. For example, you can use the `touch` command to create an empty file:

bash
touch README.md


4. Open the `README.md` file in a text editor of your choice and add the desired text. For instance, you can use the `nano` editor:

bash
nano README.md

This will open the `README.md` file in the `nano` editor. Add your desired text to the file.


5. Save and exit the text editor. In `nano`, you can press `Ctrl + X`, then `Y` to confirm saving changes, and finally press `Enter` to exit.


6. Now, you can use Git to track and commit the changes you made to the `README.md` file. Execute the following commands:

bash
git add README.md
git commit -m "Added text to README.md"

The `git add` command stages the changes you made to the `README.md` file, and the `git commit` command commits the changes to the Git repository with a escriptive message.

Now, you have created the `README.md` file and added text to it using Git. The changes are now tracked and committed in your Git repository.



About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext