Sub folder in Git project?

I have been using Subversion for a long time and now I have switched to Git.

Now I need to know how to get sub folders in my Git project?

  • Can I link git submodules with some kind of fallback URL? If SSH clone fails, git should be able to clone using https
  • What do these words mean in Git: Repository, fork, branch, clone, track?
  • git svn clone creates empty git repository?
  • Cloning a tree in git
  • Error running git“Cannot run program ”git": error=2
  • Git clone command stuck at "Cloning into 'repo'
  • I know sombody will make 2 projects for this but I dont need 2 projects for this. I need to clone a subfolder and not my main project.

    I use github.com.

  • GIT merge error “commit is not possible because you have unmerged files”
  • bash git pre-commit hook running MatLab function does not wait for a result
  • Cloning local Git repository containing a submodule with local branch
  • Jenkins “tag” build with git
  • How can I tell whether the current working directory is ignored by Git?
  • Git - checkout a single directory out of a repo - error: pathspec did not match any file(s) known to git
  • 4 Solutions collect form web for “Sub folder in Git project?”

    When cloning a git repository you always clone the whole repository.

    If you want subfolders in your project simply create them though. As soon as you add files inside them (git only tracks files no folders -> if a folder is empty you cannot add it to your repo), they can be committed to your repository by committing the files inside.

    Yes, you can! Github also provides SVN access for repositories. For example I want to get Android fonts here:
    https://github.com/android/platform_frameworks_base/tree/master/data/fonts
    Just run this command, see the pattern, replace /tree/master with /trunk:

    svn checkout https://github.com/android/platform_frameworks_base/trunk/data/fonts
    
    1. create a folder
    2. “git add” this folder
    3. “git commit -m ‘message'”
    4. “git push”

    DONE!

    I found an answer: http://blog.quilitz.de/2010/03/checkout-sub-directories-in-git-sparse-checkouts/

    I had git 1.5.5, and it requires 1.7+; now I have 1.7 and it’s all working fine. 🙂 But thanks a lot for the answer.

    Git Baby is a git and github fan, let's start git clone.