Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a text file in git-bash?

How can I make a text file in Git-bash and then how do I go into that file and add text?

like image 847
Bruce Irvine Avatar asked Mar 11 '15 04:03

Bruce Irvine


People also ask

How do I create a new TXT file?

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.

How do I edit a text file in git bash?

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.


1 Answers

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"

like image 122
SVTAnthony Avatar answered Oct 22 '22 10:10

SVTAnthony