GithubHelp home page GithubHelp logo

Comments (2)

ScrappyCocco avatar ScrappyCocco commented on June 14, 2024

Hello and nice to meet you!

So, i usually use a GUI for that, GitKraken, but doing it crom CL shouldn't be a lot different
(double-check the commands i tell you if you prefer, just understand the concept).

An external repo is considered as "Submodule". A submodule can point to any commit of the external repo.

For example, you can add the submodule GLFW at version 3.3 and keep it there, so anyone who will clone your repository will have GLFW pointing at the same commit as you at version 3.3.

Submodule file

First way

First of all you can add a submodule using the file .gitmodules you can see mine here: .gitmodules.

That file contains the url to the external repo and the local folder where you keep the submodule. Note that writing manually in the file probably isn't the best way and require you to run:

git submodule update --init --recursive

to "clone" the submodule into the specified folder.

Other (better) way to add a submodule

You can use the command

git submodule add https://github.com/ExampleUser/ExampleSubmodule.git externals/ExampleSubmodule/

that will do everything for you i think. (You can change the example path of course).

Submodule commit pointer

Once you downloaded the submodule, you may want to change the commit where it points.

I think you can just use standard git commands in the submodule folder, for example:

git checkout 3.3

to check a specific version, because:

"Submodule repositories stay in a detached HEAD state pointing to a specific commit. Changing that commit simply involves checking out a different tag or commit then adding the change to the parent repository." (quote from stackoverflow).

If you did all correctly you can commit the changes in the main repo and check on github if the submodule exist and point to the correct commit. (It will appear as submodule @ commit so you can check the commit pointer).

End

If you have other question try to google or to look at Git Submodules doc.

Please tell me if you understood or if you have any other question, otherwise have a good weekend and a good day ^^

from scrapengine.

ScrappyCocco avatar ScrappyCocco commented on June 14, 2024

Closed for no reply

from scrapengine.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.