Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6626213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:52:00+00:00 2026-05-25T21:52:00+00:00

How do you link a single file from another git repository to your own

  • 0

How do you link a single file from another git repository to your own repository? I don’t want the full repository, just a single file. Using git submodule seems like the right route to go, but it wants to grab the whole thing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:52:00+00:00Added an answer on May 25, 2026 at 9:52 pm

    Considering that the unit of work for git is a repository (or more precisely a repository content), I don’t think you can easily integrate one file.

    If you don’t need its history, you could consider simply copy it in your repo.
    But if you do need the history, then some git filter-branch (as in “git: How to split off library from project? filter-branch, subtree?“) are in order. That seems a lot of effort for just one file though.

    In theory, “git: symlink/reference to a file in an external repository” suggests a solution combining submodule and symlink.
    (from Pavel Šimerda)

    $ git submodule add /url/submodule/<reponame>
    $ ln -s <reponame>/path/to/<linked_file>
    $ git add .gitmodules <linked_file>
    $ git commit -m "add a symbolic link to <linked_file> with the respective submodule"
    

    Since 2011 (original answer above), Gavriel reports in the comments that:

    • When I checkout the main repo, the linked file is not a symlink, but instead the file content is “<reponame>/path/to/<linked_file>“.
      In other words git commits the symlink’s target as file content
    • But the basic idea works.
      I use “submodule/path/to/file” instead of “file” and it works
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to modify every single link in an HTML document.
Is is possible to trigger a link to select a single line inside textarea.
How do i fix this link in javascript. <a href=javascript:clientGalleryLink(Business)>Link</a> Its missing single quotes
Link I'm using ASP.NET with C# and trying to use linq to sql to
This link describes an exploit into my app using fckEditor: http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html How do I
I have a scenario where I want a web page to contain a <link>
I am trying to allow a single location (a file which does not exist
I am calling my makewindows function from a PHP file like so: echo <a
I'd like to use jQuery to grab all of the css file references from
Is there a way to create an html link using h:outputLink, other JSF tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.