1

I am new to git and github in particular. I am using gitbash, and I would like to upload EVERYTHING in my project folder to the repo on github.

I intially did it with the web based GUI, but for some reason it strips ALL of my files from their folder and places them all in one directory, which is weird because when I did this with a different project it went fine with all the directory structure intact.

Now for using gitbash, I first did a git init on my directory where the project lives, then did all of the config steps to get to my remote repo. When I do a git add, and then git status, it doesnt list any files (but ls does show all of my files and folders). When I create a new test file and then do git add ., then git status - it shows the new test file.

I am totally confused after an entire day of youtube and SO, I cannot push a project to the remote repo via gitbash, and cannot seem to do so in the GUI WITHOUT all of my files being stripped from their directory and put in one single directory.

abtecas
  • 279
  • 2
  • 4
  • 13
  • Possible duplicate of [Git adding files to repo](http://stackoverflow.com/questions/7047752/git-adding-files-to-repo) – TheTotalJim Apr 28 '17 at 15:46

2 Answers2

7

Using the following command inside the git repo will add all the files.

git add .

After running that command you can commit normally. For example.

git commit -m "COMMIT MESSAGE HERE"

Charlie Fish
  • 18,491
  • 19
  • 86
  • 179
  • I do that. The problem is that it ONLY will show ONE file....the issue is that I want to git add EVERYTHING in the project folder, and preserve the directory structure. The only thing git add . shows when I do git status is the test file I created, and not EVERYTHING in my directory. – abtecas Aug 01 '16 at 00:35
  • @abtecas Did you already add and commit the other files that aren't showing up? `git add .` will add everything in the directory you are currently in. That is what the `.` means. – Charlie Fish Aug 01 '16 at 00:36
  • Yes. I cd to the folder where I have the project (which contains files and folders)...and by doing git add . and then git status it shows absolutely nothing, but if I go and make a new test file and then do git add . it will THEN show me that and only that file. But why not all of the other files and folders in there as well? – abtecas Aug 01 '16 at 00:39
  • @abtecas `git status` will only show the changes made since the LAST commit. Any changes made before your last commit will not show in `git status`. – Charlie Fish Aug 01 '16 at 00:40
  • Even still....why would the GUI strip all of the files from their respective folders and just dump them all in one place with no subfolders or anything? – abtecas Aug 01 '16 at 00:41
  • @abtecas I don't understand what you are asking in that last question. – Charlie Fish Aug 01 '16 at 00:41
  • Using the GUI on github.com - when I select ALL FILES and folders in my project to be uploaded, the result is all files are taken from OUT OF any folder and just placed in ONE SINGLE DIRECTORY. So anthing in my JS folder is taken out and placed. As if ALL files have but one directory. – abtecas Aug 01 '16 at 00:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/118766/discussion-between-charlie-fish-and-abtecas). – Charlie Fish Aug 01 '16 at 00:48
0

Using the following command inside the git repo will add all the files. git add -A

elesos
  • 21
  • 5
  • 1
    Nope. This will add all unadded files in the entire *tree*, not just those in the current directory. If you are going to use this command make sure you add the ---dry-run flag to see what would be added as you might find you're adding many more files than you expected. – vt5491 Aug 30 '17 at 04:42
  • Someone apparently doubted the utility of your suggestion--- I just negated their down vote--- but I can certify that this works nicely. `git help add` shows the `--dry-run` option, and also that `-n` is the short form. – Mike O'Connor Nov 01 '17 at 06:14