2

The image here shows the multiple folder but I only want to commit only one folder "New Folder" which have files in it.

After committing and adding I want the following result not the same name but as a folder in repository

I tried :

git commit prac -m "only-folder"

error: pathspec 'folder-name' did not match any file(s) known to git
But it gives the above error.
I only want to commit one folder and then add and upload it to my github
repository as a folder only not as scattered files.
Please help me out here.
Thank You

This is the Error I am getting. This is all I am doing. I want Example folder to be on github like in Picture2. Please help me out here.

Remus Case
  • 460
  • 4
  • 12
  • Please add more details. What error are you getting? – magikarp Mar 28 '20 at 17:26
  • Add the folder to the staging area : `git add folder-name` and commit the changes `git commit -m "message"`, provided you have not done `git add .` previously and the folder `folder-name` is not empty – Saurabh P Bhandari Mar 28 '20 at 17:37
  • @SaurabhPBhandari I have not git add . previously. This will be my first time and yes other folder do contain files too – Remus Case Mar 28 '20 at 17:53
  • Please do tell me what should I do – Remus Case Mar 28 '20 at 17:54
  • @RemusCase `git add folder-name` and `git commit -m "message"` and then push it to Github, but before that you need to check the output of `git status` to make sure that `folder-name` was the only folder being staged for commit – Saurabh P Bhandari Mar 28 '20 at 17:57
  • @SaurabhPBhandari , When I do ```git add folder-name```, it gives me fatal: adding files failed and error folder-name does not have commit checked out. How can I change the staging area to only that folder. Though ```git status``` gives me , Untracked files and all the folder names below. – Remus Case Mar 28 '20 at 18:04
  • @RemusCase You should update the question with the output of the same – Saurabh P Bhandari Mar 28 '20 at 18:09
  • @SaurabhPBhandari , Please do look into the question I have provided another screenshot at the end, which shows what I am trying to do. And the error it shows. – Remus Case Mar 28 '20 at 18:50
  • @ShreyaMalviya , I have tried to give all the details. Please do look into it. Thank You. – Remus Case Mar 28 '20 at 18:50
  • @RemusCase See [this](https://stackoverflow.com/q/56873278/10155936) – Saurabh P Bhandari Mar 29 '20 at 01:06

0 Answers0