Recursively add the entire folder to a repository

后端 未结 15 1279
野的像风
野的像风 2020-11-30 16:23

I am trying to add a branch to the master branch on GitHub and push a folder onto that branch.

The folder structure of the branch looks like - SocialApp/SourceCode/D

相关标签:
15条回答
  • 2020-11-30 16:41

    Both "git add *" and "git add SocialApp" called from top directory should add recursively all directories.

    Probably you have no files in SocialApp/SourceCode/DevTrunk/SocialApp and this is the reason.

    Try to call "touch SocialApp/SourceCode/DevTrunk/SocialApp/.temporary" (and check .gitignore) and then try git add again.

    0 讨论(0)
  • 2020-11-30 16:41

    I simply used this:

    git add app/src/release/*
    

    You simply need to specify the folder to add and then use * to add everything that is inside recursively.

    0 讨论(0)
  • 2020-11-30 16:42

    This worked for me:

    git add . --force
    
    0 讨论(0)
  • 2020-11-30 16:48

    In my case, there was a .git folder in the subdirectory because I had previously initialized a git repo there. When I added the subdirectory it simply added it as a subproject without adding any of the contained files.

    I solved the issue by removing the git repository from the subdirectory and then re-adding the folder.

    0 讨论(0)
  • 2020-11-30 16:50

    Check the .gitignore file, if the subdirectory is ignored.

    Then try again

    git add --all
    git commit -am "<commit message>"
    git push
    
    0 讨论(0)
  • 2020-11-30 16:51

    Navigate to the folder where you have your files
    if you are on a windows machine you will need to start git bash from which you will get a command line interface then use these commands

    git init   //this initializes a .git  repository in your working directory
    
    git remote add origin <URL_TO_YOUR_REPO.git> // this points to correct repository where files will be uploaded
    
    git add *   // this adds all the files to the initialialized git repository
    

    if you make any changes to the files before merging it to the master you have to commit the changes by executing

    git commit -m "applied some changes to the branch"
    

    After this checkout the branch to the master branch

    0 讨论(0)
提交回复
热议问题