FreeKB - How to add a file in Git
How to add a file in Git

Home > Search > How-to


If you are not familiar with Git, check out our getting started article. These examples are based on Linux.

These examples are based on Linux. Let's say the root directory of your master Git repository is /var/git. Move into the root directory.

cd /var/git

 

Create a new file.

touch foo.txt

 

Add the new file to Git.

git add foo.txt

 

The git status command will now show that foo.txt is ready to be committed.

git status
. . .
Changes to be committed:
. . .
  new file: foo.txt

 

You would then commit the new file.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter f7b1a in the box below so that we can be sure you are a human.




Comments