How can I make a text file in Git-bash and then how do I go into that file and add text?
Another way to create a text file is to right-click an empty area on the desktop, and in the pop-up menu, select New, and then select Text Document. Creating a text file this way opens your default text editor with a blank text file on your desktop. You can change the name of the file to anything you want.
The best way for me to edit a file in Git Bash is the command 'nano fileName. txt'. This command opens editing mode. After having your work done, press Ctrl + x.
There are many ways to create a file using BASH.
using touch touch newFile.txt
only creates.
using echo echo > newFile.txt
only creates.
using cat cat > newFile.txt
creates and can start appending to file.
using vim vim newFile.txt
creates and can start editing the file.
Also the .txt extension is only for convenience and categorization. Some editors view the extension to format the data, but for a txt
there's no differnce.
After creating the file, add it to the git repository.
git add newFile.txt
git commit -m "added new file"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With