So at this point I assume you should know How to create a Repository, If you don't do checkout my previous article here.
Let's dive in and add files via the Command Line.
Follow the steps 1, 2 and 3 from my previous article!
Assuming you have a folder created in your local machine, Open the terminal and redirect to the project directory. (I have three files with boilerplate code)
-
Run the following command to Initialize the repository.
git init
- Now you have to let your machine know which remote repository you're planning to work on. To do that copy the
git remote add origin <url>
line from the 3rd step and execute it.
- To add all files run
git add .
or you can add only a specific file by executing
git add <filename>
The former will add files to the changing area and the later will add only the index.html file.
- After running the commands, If you want to check the status of your working directory execute
git status
It will give you an overview of the changes that are tracked and has been added to the stage.
- Now, to create a commit execute
git commit -m"<Desc. of your commit>"
- Finally push your changes by executing
git push origin <branch name>
- You should now see your files in the repository! _________________________
Feel free to drop your suggestions in the comments and if you find it useful give me a like and share it with someone who might benefit from it.
Reach out to me on my Instagram @monish.codes If you have any queries or just want to have a conversation! See you on the flip side.
Top comments (0)