ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved GitLab Symlink folder to another project?

    IT Discussion
    5
    8
    4.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ObsolesceO
      Obsolesce
      last edited by

      I have a project in GitLab, let's call it /project1.git.
      I have another project in GitLab, let's call that one /project2.git.

      In /project2.git, is it possible to symlink a folder project2/folder to /project1?

      1 Reply Last reply Reply Quote 0
      • ObsolesceO
        Obsolesce @stacksofplates
        last edited by Obsolesce

        @stacksofplates said in GitLab Symlink folder to another project?:

        Use submodules for this.

        git submodule add https://gitlab.com/<user>/repo repo

        Thanks, this is exactly what I was looking for!

        Looked up submodules, and found two good references, posting them here for future reference.

        https://git-scm.com/book/en/v2/Git-Tools-Submodules

        https://docs.gitlab.com/ee/ci/git_submodules.html

        1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller
          last edited by

          That feels like a really bad idea.

          1 Reply Last reply Reply Quote 0
          • ObsolesceO
            Obsolesce
            last edited by

            What I want to avoid doing is copying and pasting code from project1 into a folder in project2 every time it changes.

            1 Reply Last reply Reply Quote 0
            • black3dynamiteB
              black3dynamite
              last edited by

              Take a look this.
              https://gist.github.com/whistler/de34b77aba2221ed8b2e

              1 Reply Last reply Reply Quote 1
              • stacksofplatesS
                stacksofplates
                last edited by stacksofplates

                Use submodules for this.

                git submodule add https://gitlab.com/<user>/repo repo

                matteo nunziatiM ObsolesceO 2 Replies Last reply Reply Quote 3
                • matteo nunziatiM
                  matteo nunziati @stacksofplates
                  last edited by

                  @stacksofplates said in GitLab Symlink folder to another project?:

                  Use submodules for this.

                  git submodule add https://gitlab.com/<user>/repo repo

                  Yes submodule is the right way. Isolate common code into a library. Make a git for the lib. Submodule it in both of your projects.

                  1 Reply Last reply Reply Quote 1
                  • matteo nunziatiM
                    matteo nunziati
                    last edited by

                    @Tim_G now that you have submoduled a folder guess: how to remove that folder from project1. Or better how to move the entire history of 'folder' into a new git?! Welcome to hell buahahah... (Done this one time. Still recovering from it :p)

                    1 Reply Last reply Reply Quote 0
                    • ObsolesceO
                      Obsolesce @stacksofplates
                      last edited by Obsolesce

                      @stacksofplates said in GitLab Symlink folder to another project?:

                      Use submodules for this.

                      git submodule add https://gitlab.com/<user>/repo repo

                      Thanks, this is exactly what I was looking for!

                      Looked up submodules, and found two good references, posting them here for future reference.

                      https://git-scm.com/book/en/v2/Git-Tools-Submodules

                      https://docs.gitlab.com/ee/ci/git_submodules.html

                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      • First post
                        Last post