GIT - connecting existing code to a separate Repository in the same Local machine









up vote
0
down vote

favorite












Say I have my existing VS2015 code in C:Proj1, and I have created a repository in C:RepoProj1.



Now I want to connect my project at C:Proj1 to the Repository at C:RepoProj1.



The problem is when I click on the Publish button in the lower right end of VS2015 window, of VS2015 project (loaded from C:Proj1), it creates the GIT Repository locally inside my project directory (the hidden .git directory, attributes and ignore files). Instead of connecting to the local .git repository, I would like to connect to the repository at C:RepoProj1, everytime I open/use my VS2015 project in C:Proj1



I am using VS2015 (SP3) on Win10.



How to do it? Thanks in advance...










share|improve this question

























    up vote
    0
    down vote

    favorite












    Say I have my existing VS2015 code in C:Proj1, and I have created a repository in C:RepoProj1.



    Now I want to connect my project at C:Proj1 to the Repository at C:RepoProj1.



    The problem is when I click on the Publish button in the lower right end of VS2015 window, of VS2015 project (loaded from C:Proj1), it creates the GIT Repository locally inside my project directory (the hidden .git directory, attributes and ignore files). Instead of connecting to the local .git repository, I would like to connect to the repository at C:RepoProj1, everytime I open/use my VS2015 project in C:Proj1



    I am using VS2015 (SP3) on Win10.



    How to do it? Thanks in advance...










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Say I have my existing VS2015 code in C:Proj1, and I have created a repository in C:RepoProj1.



      Now I want to connect my project at C:Proj1 to the Repository at C:RepoProj1.



      The problem is when I click on the Publish button in the lower right end of VS2015 window, of VS2015 project (loaded from C:Proj1), it creates the GIT Repository locally inside my project directory (the hidden .git directory, attributes and ignore files). Instead of connecting to the local .git repository, I would like to connect to the repository at C:RepoProj1, everytime I open/use my VS2015 project in C:Proj1



      I am using VS2015 (SP3) on Win10.



      How to do it? Thanks in advance...










      share|improve this question













      Say I have my existing VS2015 code in C:Proj1, and I have created a repository in C:RepoProj1.



      Now I want to connect my project at C:Proj1 to the Repository at C:RepoProj1.



      The problem is when I click on the Publish button in the lower right end of VS2015 window, of VS2015 project (loaded from C:Proj1), it creates the GIT Repository locally inside my project directory (the hidden .git directory, attributes and ignore files). Instead of connecting to the local .git repository, I would like to connect to the repository at C:RepoProj1, everytime I open/use my VS2015 project in C:Proj1



      I am using VS2015 (SP3) on Win10.



      How to do it? Thanks in advance...







      git visual-studio-2015






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 12:51









      XMarshall

      4363518




      4363518






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          0
          down vote













          I'm not exactly sure what you mean by




          Now I want to connect my project




          I believe you're going to want to move/copy your source code into the repo directory (with the .git folder).



          And then work out of the repo directory.



          You can start a new repo with git clone or git init and then you will want to work out of that directory so the .git folder can track everything.






          share|improve this answer
















          • 1




            Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
            – XMarshall
            Nov 9 at 14:44

















          up vote
          0
          down vote













          You can make your project at C:Proj1 a submodule of C:RepoProj1



          Just go to C:RepoProj1 and execute in bash:



          git submodule add C:/Proj1



          Then go to C:Proj1:



          git submodule init
          git submodule update


          Find more here: https://stackoverflow.com/a/36554930






          share|improve this answer



























            up vote
            0
            down vote













            It sounds to me as if you have created the repository in the wrong place.. perhaps you could symlink the folders inside.



            You can do this using an elevated command prompt;



            mklink /d "C:RepoProj1" "C:Proj1"


            /d - create a directory link
            (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink)



            Quote's aren't required if you don't have spaces in the directory names - but imo are recommended for good practice.






            share|improve this answer




















              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226047%2fgit-connecting-existing-code-to-a-separate-repository-in-the-same-local-machin%23new-answer', 'question_page');

              );

              Post as a guest






























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              0
              down vote













              I'm not exactly sure what you mean by




              Now I want to connect my project




              I believe you're going to want to move/copy your source code into the repo directory (with the .git folder).



              And then work out of the repo directory.



              You can start a new repo with git clone or git init and then you will want to work out of that directory so the .git folder can track everything.






              share|improve this answer
















              • 1




                Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
                – XMarshall
                Nov 9 at 14:44














              up vote
              0
              down vote













              I'm not exactly sure what you mean by




              Now I want to connect my project




              I believe you're going to want to move/copy your source code into the repo directory (with the .git folder).



              And then work out of the repo directory.



              You can start a new repo with git clone or git init and then you will want to work out of that directory so the .git folder can track everything.






              share|improve this answer
















              • 1




                Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
                – XMarshall
                Nov 9 at 14:44












              up vote
              0
              down vote










              up vote
              0
              down vote









              I'm not exactly sure what you mean by




              Now I want to connect my project




              I believe you're going to want to move/copy your source code into the repo directory (with the .git folder).



              And then work out of the repo directory.



              You can start a new repo with git clone or git init and then you will want to work out of that directory so the .git folder can track everything.






              share|improve this answer












              I'm not exactly sure what you mean by




              Now I want to connect my project




              I believe you're going to want to move/copy your source code into the repo directory (with the .git folder).



              And then work out of the repo directory.



              You can start a new repo with git clone or git init and then you will want to work out of that directory so the .git folder can track everything.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 9 at 12:59









              JBoothUA

              687222




              687222







              • 1




                Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
                – XMarshall
                Nov 9 at 14:44












              • 1




                Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
                – XMarshall
                Nov 9 at 14:44







              1




              1




              Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
              – XMarshall
              Nov 9 at 14:44




              Thanks to everybody for their Answers. My idea was to keep the Repository in a separate directory, other than my actual project directory. Because, what if I delete my actual project directory my mistake, I can then have my files back from the repository again. Off course since .git directory is hidden, it will not be deleted or I will be asked if I want to delete it. Basically, I was trying to implement the same concept of URL based remote Repository, but in my case, it will be in my same local machine, but in a different location. Probably I am not thinking in the right direction...
              – XMarshall
              Nov 9 at 14:44












              up vote
              0
              down vote













              You can make your project at C:Proj1 a submodule of C:RepoProj1



              Just go to C:RepoProj1 and execute in bash:



              git submodule add C:/Proj1



              Then go to C:Proj1:



              git submodule init
              git submodule update


              Find more here: https://stackoverflow.com/a/36554930






              share|improve this answer
























                up vote
                0
                down vote













                You can make your project at C:Proj1 a submodule of C:RepoProj1



                Just go to C:RepoProj1 and execute in bash:



                git submodule add C:/Proj1



                Then go to C:Proj1:



                git submodule init
                git submodule update


                Find more here: https://stackoverflow.com/a/36554930






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  You can make your project at C:Proj1 a submodule of C:RepoProj1



                  Just go to C:RepoProj1 and execute in bash:



                  git submodule add C:/Proj1



                  Then go to C:Proj1:



                  git submodule init
                  git submodule update


                  Find more here: https://stackoverflow.com/a/36554930






                  share|improve this answer












                  You can make your project at C:Proj1 a submodule of C:RepoProj1



                  Just go to C:RepoProj1 and execute in bash:



                  git submodule add C:/Proj1



                  Then go to C:Proj1:



                  git submodule init
                  git submodule update


                  Find more here: https://stackoverflow.com/a/36554930







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 9 at 13:03









                  mibrl12

                  193115




                  193115




















                      up vote
                      0
                      down vote













                      It sounds to me as if you have created the repository in the wrong place.. perhaps you could symlink the folders inside.



                      You can do this using an elevated command prompt;



                      mklink /d "C:RepoProj1" "C:Proj1"


                      /d - create a directory link
                      (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink)



                      Quote's aren't required if you don't have spaces in the directory names - but imo are recommended for good practice.






                      share|improve this answer
























                        up vote
                        0
                        down vote













                        It sounds to me as if you have created the repository in the wrong place.. perhaps you could symlink the folders inside.



                        You can do this using an elevated command prompt;



                        mklink /d "C:RepoProj1" "C:Proj1"


                        /d - create a directory link
                        (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink)



                        Quote's aren't required if you don't have spaces in the directory names - but imo are recommended for good practice.






                        share|improve this answer






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          It sounds to me as if you have created the repository in the wrong place.. perhaps you could symlink the folders inside.



                          You can do this using an elevated command prompt;



                          mklink /d "C:RepoProj1" "C:Proj1"


                          /d - create a directory link
                          (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink)



                          Quote's aren't required if you don't have spaces in the directory names - but imo are recommended for good practice.






                          share|improve this answer












                          It sounds to me as if you have created the repository in the wrong place.. perhaps you could symlink the folders inside.



                          You can do this using an elevated command prompt;



                          mklink /d "C:RepoProj1" "C:Proj1"


                          /d - create a directory link
                          (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink)



                          Quote's aren't required if you don't have spaces in the directory names - but imo are recommended for good practice.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 9 at 13:04









                          essdeeeff

                          63




                          63



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226047%2fgit-connecting-existing-code-to-a-separate-repository-in-the-same-local-machin%23new-answer', 'question_page');

                              );

                              Post as a guest














































































                              Popular posts from this blog

                              Use pre created SQLite database for Android project in kotlin

                              Darth Vader #20

                              Ondo