Recursively add the entire folder to a repository

后端 未结 15 1281
野的像风
野的像风 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:55

    SETUP

    • local repository at a local server
    • client is connected to the local server via LAN

    UPDATE(Sep 2020): use foldername/\* instead of foldername/\\*:

    git add foldername/\*
    

    To make it to the server...

    git commit -m "comments..."
    git push remote_server_name master
    

    Mostly, users will assign remote_server_name as origin...

    git remote add remote_server_name username@git_server_ip:/path/to/git_repo
    
    0 讨论(0)
  • 2020-11-30 16:57

    I just needed to do this, and I found that you can easily add files in subdirectories. You only need to be on the "top directory" of the repo, and then run something like:

    $ git add ./subdir/file_in_subdir.txt
    
    0 讨论(0)
  • 2020-11-30 16:57

    This worked for me

    git add -f *
    
    0 讨论(0)
  • 2020-11-30 16:59

    There are times that I want to include my web service source codes along with its client-side project. Both of them have a separate git repositories. I am actually used to add all files using the command:

    git add -A
    

    But for some reason, it only adds the folder. Later on I found out that the server files also have its .git folder in it so the command doesn't work.

    tl;dr: Make sure there are no .git folder inside the folder you want to stage.

    0 讨论(0)
  • 2020-11-30 17:01

    I also had the same issue and I do not have .gitignore file. My problem was solved with the following way. This took all sub-directories and files.

    git add <directory>/*
    
    0 讨论(0)
  • 2020-11-30 17:01

    git add --all my/awesome/stuff/ works for me. [1]

    1. https://git-scm.com/docs/git-add
    0 讨论(0)
提交回复
热议问题