Git Submodules Tutorial | For Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ค. 2024
  • Hello! Today's video is looking at Git Submodules. Most people think badly of submodules and tend to stay away from them, but I have been using them lately and really enjoyed working with them! I hope you enjoy :)
    Useful Links:
    GitHub: github.com/redhwannacef/git-s...
    Git Submodules: git-scm.com/book/en/v2/Git-To...
    Music:
    • Timeless
    Huge thank you to Harris Heller for providing copyright-free music.
    Timestamps:
    0:00 - Intro
    0:30 - What?
    2:07- Why/When?
    3:36 - Show me the code!
    14:30 - Thank You For Watching!
    ------------------------
    Hey everyone! My name is Redhwan Nacef (Red for short). In this channel, I'm hoping to share my thoughts on software engineering, coding, management, and all things tech. I hope you enjoy!
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 227

  • @lambertoXD
    @lambertoXD 3 ปีที่แล้ว +22

    I was looking for an answer regarding the cloning of submodules and you covered it in an incredibly clear way ! Thanks for that, great video!

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว

      You're very welcome, glad it helped! Thank you for the feedback.

  • @Quacky_Batak
    @Quacky_Batak 2 ปีที่แล้ว +4

    Great tutorial, concise and great explanation. Thanks for showing all the other tutorials name in this video. Earned a sub 👍

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว +1

      Thanks for the feedback and the sub. 🙂

  • @maitreverge
    @maitreverge 9 หลายเดือนก่อน +1

    This is a precious video, thanks for clarifying this subject !

  • @warisulimam3440
    @warisulimam3440 2 ปีที่แล้ว +39

    Simple and precise explanations, incredibly helpful. Thank you so much!

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว +1

      Thanks! Glad you enjoyed it 😊

  • @BrocchiRodrigo
    @BrocchiRodrigo 2 วันที่ผ่านมา

    I enjoyed the content! It helped me a lot with a project I'm working on with some colleagues.
    Very nice!

  • @ivandimitryzyrianoff203
    @ivandimitryzyrianoff203 2 ปีที่แล้ว +1

    Thanks for the video! It helped me solved a issue that I was struggling for a whole day

  • @erniepasveer8027
    @erniepasveer8027 4 วันที่ผ่านมา

    Clear and concise. Good presentation style and technique.

  • @nikitakrasnytskyi
    @nikitakrasnytskyi 4 หลายเดือนก่อน

    I just want to leave feedback here. I find your way of giving a material to be of very high quality. Compared to many others on learning platforms, you can give material fast and keep the essential pieces. Like, you only cover the most vital submodule commands. Really appreciate the way you teach. Saw this video and subscribed for more.

  • @alexleung842
    @alexleung842 8 หลายเดือนก่อน

    Best git submodules tutorial I've seen

  • @Squirrelies1
    @Squirrelies1 6 หลายเดือนก่อน

    Well presented, clear, and informative! Great job! Thank you. :)

  • @krisculin9679
    @krisculin9679 ปีที่แล้ว +1

    This was a very nice beginner's look at submodules. Thank you.

  • @JayJay-ki4mi
    @JayJay-ki4mi 2 ปีที่แล้ว +3

    Redhwan: "This will take a few seconds"
    Boost: "Go grab a coffee"

  • @anuragchauhan5170
    @anuragchauhan5170 ปีที่แล้ว +2

    Very well done, awesome tutorial, clean and precise :)

  • @IreshDissanayakaM
    @IreshDissanayakaM 2 ปีที่แล้ว +2

    This was great! Nice explanation. Now I can start using git submodules.

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว +1

      Thanks, glad it helped! 🙂

  • @patryktraczyk3246
    @patryktraczyk3246 3 ปีที่แล้ว +2

    Really good explanation! Great video, thanks for it!

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว +1

      Thanks, glad it was helpful!

  • @habibmosavi
    @habibmosavi 4 หลายเดือนก่อน

    Very simple and clear, thanks man!

  • @gregormurray314
    @gregormurray314 9 หลายเดือนก่อน

    Thank you from a fellow scot, i am messing about with robot programming and need to share python and nodejs code between the code running on the robot and the code running on the desktop this gave me the overview i needed to realise that submodules were the elegant solution i needed. So many other options i have tried just gave me a major headache.

  • @theneilpowers
    @theneilpowers 2 ปีที่แล้ว +1

    Excellent tutorial. Answered all my questions and more.

  • @lifeisbeautifu1
    @lifeisbeautifu1 2 หลายเดือนก่อน

    Amazing, thank you!

  • @danielvega646
    @danielvega646 ปีที่แล้ว +1

    Neato! Amazing explanation, thanks a lot. Greetings from Colombia. Keep it up!

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Hello Colombia! Glad you enjoyed it 😊

  • @cerealkiller6675
    @cerealkiller6675 6 หลายเดือนก่อน

    Perfect ! Thanks for this tutorial

  • @thaynethetigerbarnes
    @thaynethetigerbarnes หลายเดือนก่อน

    I think you helped me with a huge problem, I am trying to use strapi for my back-end and I have struggled getting it to commit in one repo I do believe this will be the fix! TY!

  • @tonyjaradev
    @tonyjaradev 2 ปีที่แล้ว +1

    Also this is amazing for managing typescript between projects (I think, gonna try now) Thank you so much!

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      Hope it goes well! Anytime 🙂

  • @_dinesh
    @_dinesh 2 ปีที่แล้ว +4

    Precise and straight to the point. Thank you so much. ❣

  • @refused_hc7882
    @refused_hc7882 5 หลายเดือนก่อน

    Thanks for your time, totally helpful!

  • @marmalamuc
    @marmalamuc 2 ปีที่แล้ว +4

    Your video really simplified this process for me! One question though:
    In other videos & articles, I've seen people say that, in order to incorporate changes from the submodule's repo, you have to run `git submodule update --remote` in the superproject repo before adding/committing/pushing. It looks like you didn't do that here, but everything worked fine.
    Do you know if `git submodule update --remote` is necessary?

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว +4

      Glad it helped.
      The reason I did not need that command here is because I updated the submodule directly from within the parent project. So there were no other changes in the remote. If for example a colleague had updated the submodule else where, my local copy would not know about that, so I would need to ensure it is updated before developing. One way to do it is with the command `git submodule update --remote`, the other would be to `cd` into the submodule repo, checkout master and just do a git pull. Hopefully that makes sense?

  • @gpeta42
    @gpeta42 ปีที่แล้ว +1

    Thank's you man 🤝, very useful

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน

      You're welcome 👍

  • @import-ai
    @import-ai ปีที่แล้ว +1

    Brilliant explanation. Thank you so much!

  • @ricardomonicat7564
    @ricardomonicat7564 10 หลายเดือนก่อน +1

    Clean and usefull explanations. Thank you!!!.

    • @RedhwanNacef
      @RedhwanNacef  10 หลายเดือนก่อน

      Glad you liked it!

  • @l.243
    @l.243 2 ปีที่แล้ว +1

    Thanks for the video, it explains the matter clearly.

  • @MayureshKadu
    @MayureshKadu 8 หลายเดือนก่อน

    Very useful and well explained. Thanks

  • @hussainshaik4390
    @hussainshaik4390 ปีที่แล้ว +1

    wow simple and yet all i needed

  • @Stonk5331
    @Stonk5331 ปีที่แล้ว +1

    Clear & Precise!

  • @luizcesarmerjandepaula6067
    @luizcesarmerjandepaula6067 2 ปีที่แล้ว +1

    Nice! Thank you for the content

  • @JimmyWorld
    @JimmyWorld 2 ปีที่แล้ว +1

    Excellent explanation. Thanks.

  • @GTsurwa
    @GTsurwa ปีที่แล้ว

    Fantastic Explanation. Many Thanks.

  • @senr4in
    @senr4in 5 หลายเดือนก่อน +1

    This is helpful, thanks

  • @isholaoluwatomisin1906
    @isholaoluwatomisin1906 ปีที่แล้ว +3

    Detailed explanation to get started with submodules.
    You could also use the "git submodule update --remote" to update the submodules if the changes were made by another member of your team(Not locally).

    • @EddieDemon
      @EddieDemon ปีที่แล้ว

      Biggest question mark I was left with, thanks for answering!

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Thanks for the additional information.

  • @iambiswajitsahoo
    @iambiswajitsahoo ปีที่แล้ว +1

    Thank you very much for making this video ☺️

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Thank you very much for watching 😊

  • @MohammadhosseinMalekpour
    @MohammadhosseinMalekpour 11 วันที่ผ่านมา

    Great, thanks man.

  • @eric-ampire
    @eric-ampire 6 หลายเดือนก่อน

    Great explanation

  • @JuanPortalG
    @JuanPortalG ปีที่แล้ว +1

    Thanks, man!

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน

      No problem!

  • @davidkind9587
    @davidkind9587 3 ปีที่แล้ว +4

    great explanation, thanks

  • @charan775
    @charan775 10 หลายเดือนก่อน +1

    best tutorial for submodule concept

    • @RedhwanNacef
      @RedhwanNacef  10 หลายเดือนก่อน

      Glad you liked it, thanks!

  • @cthulhu7397
    @cthulhu7397 ปีที่แล้ว +1

    clearly explained, thank you

  • @jimbobear1812
    @jimbobear1812 ปีที่แล้ว +1

    This guy rocks. Thank you!

  • @Ultrajuiced
    @Ultrajuiced 2 ปีที่แล้ว +1

    Thanks for the explanation.

  • @projetoforum7685
    @projetoforum7685 2 ปีที่แล้ว +1

    Thank you so much, excellent tutorial

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      You're very welcome, glad you liked it.

  • @rwboshae
    @rwboshae 2 ปีที่แล้ว +1

    Very good tutorial, thanks.

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      Thank you and you’re welcome 😊

  • @stanislavlyu1827
    @stanislavlyu1827 7 หลายเดือนก่อน

    Thank you for the tutorial. I have a question, what about private submodule repo?

  • @sonnix31
    @sonnix31 ปีที่แล้ว +1

    Very nice, thank you

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Thanks and you're welcome 😊

  • @eryks2269
    @eryks2269 2 ปีที่แล้ว +1

    Good explanation, thank you.

  • @mhasadi78
    @mhasadi78 2 ปีที่แล้ว +1

    Good tutorial, appreciated.

  • @judeurban1456
    @judeurban1456 ปีที่แล้ว

    Great video. I'm curious how you are displaying the options of a command inside the terminal? It's almost like a dynamic "--help" flag as you're typing out the command. Never seen this before. Is this a feature internal to PyCharm?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Thanks. This is not the IDE but the shell. I believe I was using zshell and oh my zsh at this point (I now use fish shell), if you search for those terms you should find what you are looking for.

  • @nicolasmenescardi4077
    @nicolasmenescardi4077 3 ปีที่แล้ว +1

    great video. Thanks!

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว

      Glad you liked it! Thanks 😊

  • @stephencovrig8373
    @stephencovrig8373 ปีที่แล้ว +1

    Awesome tutorial

  • @vishekkumar3184
    @vishekkumar3184 2 ปีที่แล้ว +1

    Hi Nice explanation!!! I have one query, if we initialize a sub-module so for which branch of sub-module project it is considered in the parent project?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Thanks! You can specify the submodule branch in the .gitmodules directory, if not it defaults to the remote HEAD (which basically means it defaults to the default branch). Hope that helps!

  • @joe_j
    @joe_j ปีที่แล้ว +1

    This was really helpful .Than you

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Glad to hear that, thanks.

  • @LewisCampbellTech
    @LewisCampbellTech 2 ปีที่แล้ว +1

    Good explanation. Last time I had to share a unit of in-house code between two projects I went with the internal NPM package, which was a bit of a nightmare to set up, deal with special keys etc etc. This would have been cleaner.

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      Thanks! Yea I have done the exact same thing before, always good to better understand the alternatives. 🙂

  • @michaelakin766
    @michaelakin766 ปีที่แล้ว +1

    Great video. Question for you. I have a git repo that I need to break into different repos with submodules. Do you know of a way to do that and keep the git history for each new repo?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว +1

      Thanks. Not sure if there is an easy way to do that, I remember hearing about a project where this was done but it was all manual with cherry picking etc. There may be some tools out there that might help with this. Good luck!

  • @matheusglauber4261
    @matheusglauber4261 ปีที่แล้ว +1

    Very good video, very helpful, tks

  • @juneroyd.quinimon495
    @juneroyd.quinimon495 2 ปีที่แล้ว +2

    Thank you for the video tutorial, it helps me a lot! keep up

  • @osys7832
    @osys7832 11 หลายเดือนก่อน +1

    I’m not a git guru but to sum up
    - git submodule is a fancy name for submodules, they’re essentially just git projects
    - any commands u can use with your own git project can be used inside the modele projects(git push pull etc)
    - to recursively install submodules -recursive-submodules is necessary with git pull or clone
    - same thing goes for the git push as well

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน

      You got it! The .gitmodules file is probably a good thing to remember too when summing up.

  • @Sunil_KumarDas
    @Sunil_KumarDas ปีที่แล้ว +4

    0.75 Playback speed + focus helps.

  • @CodeProps
    @CodeProps 2 ปีที่แล้ว +1

    This was really helpful

  • @sameerakhatoon9508
    @sameerakhatoon9508 2 ปีที่แล้ว +2

    this was lit, ty sm

  • @azharlihan
    @azharlihan 7 หลายเดือนก่อน

    Thanks for the explanation. Simple and I can easily understand.
    But how to remove submodule completely from main repository? For example, remove youtube-tutorial submodule from git-submodule-tutorial repository?

  • @taylorfritz6648
    @taylorfritz6648 2 ปีที่แล้ว +3

    This was so helpful! I do have a question though... I made a change in my submodule repo but the change never showed up in my parent repo. Is there where I need to explicitly ask git to go update to the latest commit in that submodule?

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      Thank you! Thats right (assuming you have committed and pushed the changes in the submodule). I usually "cd" in to the submodule from the parent repo and git pull from there, but you can also use the submodule commands from the parent directory and that should do the trick. 👍🏽

    • @taylorfritz6648
      @taylorfritz6648 2 ปีที่แล้ว +1

      @@RedhwanNacef Thank you so much for responding! A little bit after I asked, I ended up figuring out how to pull in those changes and then push/commit those changes to the submodule as a part of the parent repo. You said it very clearly here too, to track exactly what I was doing! Thanks again! :)

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      Anytime 😊

  • @azir8930
    @azir8930 ปีที่แล้ว +1

    ❤‍🔥

  • @richardbaumgartel
    @richardbaumgartel 7 หลายเดือนก่อน +2

    For me it was a little bit confusing, that the name of the "normal repository" contains the word submodule and the submodule itself didn't. I had to wrap my head around this couple of times but could have been just me.
    Other then that: Great explanation!

  • @CoderHarsh
    @CoderHarsh 3 หลายเดือนก่อน

    Thanks ❤

  • @markrussell5587
    @markrussell5587 3 ปีที่แล้ว +2

    that was great thanks

  • @danumichael2143
    @danumichael2143 2 ปีที่แล้ว +1

    Great video

  • @AlexSmith-fs6ro
    @AlexSmith-fs6ro 3 ปีที่แล้ว +1

    Can you specify a submodule to reference a branch rather than a commit hash?
    The idea is to work on that submodule branch, ie new commits, push, pull/fetch, rebase. Then merge the submodule branch into, say, master.
    Can you specify a tag for the submodule?

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว +1

      I don't think you can, it will always reference a commit, however, you can specify a commit hash from a different branch. For example, you can specify a branch in the .gitmodules file and it will use the latest commit hash from the branch. You can still do the workflow you have specified, you will just need to make sure you use the right commit hash once merged. I don't you can specify a tag either, but again a tag will always be linked to a commit hash so I think you could use that commit. Hope that helps!

  • @user-kc3gl9dj2w
    @user-kc3gl9dj2w ปีที่แล้ว +1

    Nice explanation.

  • @user-vs5qs2mr1y
    @user-vs5qs2mr1y 3 หลายเดือนก่อน

    but if we have more than one submodule and we want to downoloaded only a specific submodule into the main repo ?

  • @batfos
    @batfos 2 ปีที่แล้ว +1

    Thank you

  • @Chemaclass
    @Chemaclass 3 ปีที่แล้ว +1

    Thanks a lot!

  • @MaherKheder3
    @MaherKheder3 3 ปีที่แล้ว +3

    thank you for Video.
    question: how you can show the options in command line like in min : 14:02 ?

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว +2

      Anytime. I use zsh with the git plugin: github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git. which gives me that functionality :)

  • @DjSeymur
    @DjSeymur ปีที่แล้ว +1

    Is there a way to do this with branches in the same repository instead of two different repositories ?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Not sure, I have never thought to do that. You could always try add the path/url and see if it works?

  • @kadiryumlu
    @kadiryumlu 5 หลายเดือนก่อน

    Should I create a seperate repo for submodule?

  • @praveenkore842
    @praveenkore842 ปีที่แล้ว +1

    nice info brother

  • @CvetanSimsic
    @CvetanSimsic 2 ปีที่แล้ว

    What does git submodule point to by default? I know exact answer is certain commit hash, but how is that chosen and at which time? Can it be configured? How exectly does process of updating submodule go.

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      If I remember correctly, it will point to either the remote HEAD by default. You can specify a branch in the .gitmodules files too to override this. Then from that branch it will take the latest commit hash. In terms of what time, it will be at the time of running the command. Does that help?

  • @danielcorzo7498
    @danielcorzo7498 2 ปีที่แล้ว +1

    Great Video!! 👍👍 What if I'm cloning a third party tool that I'm not going to be making commits to, or very small changes at most? Can I just pull the commits to that repo?

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว +1

      Thank you! Yea the same approach can used with any repository as long as it is publicly accessible. Not sure if you have a specific use case in mind?

    • @danielcorzo7498
      @danielcorzo7498 2 ปีที่แล้ว +1

      @@RedhwanNacef I was thinking about receiving any changes they make in their repo. I may not make any changes to that third party tool myself. Forvige me, I'm still a noob 🙈

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว +1

      Yea that makes sense. Git submodules should work fine for that. No worries, you will be a pro in no time!

  • @user-Mark750
    @user-Mark750 ปีที่แล้ว

    Hi, it doesn't make much sense to use always the latest commit of a library. What can I do if I want to use e.g. tag V1.0 of a lib which is one of my submodules?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      You can just checkout that branch/tag/commit in the submodule and make sure to commit the parent module. It will only ever update if committed so that should work fine.

  • @HelpingHands3838
    @HelpingHands3838 3 ปีที่แล้ว +2

    Thanks for the explanation 👍
    One clarification needed...
    I own a repo called repo1 and it has a submodule called repo2. The repo2 has two files namely a.txt and b.txt . I want to create a new file c.txt in repo1 . I want to make sure the c.txt file should have the content of a.txt which is available under repo2 through submodule. How could I achieve this ? Any changes to a.txt in repo2 (in actual repo) also should reflect in my c.txt
    Hope I m not confusing... 😀

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว +2

      Anytime :) This depends on the tech used of course and exactly what you are trying to achieve. In general, if you need c.txt to contain content from the submodule, you could add a simple script that copies that content over. Then just run this script anytime you update the submodule. (or even a script that does both). Hope that helps, but if you are looking for something more specific let me know.

    • @HelpingHands3838
      @HelpingHands3838 3 ปีที่แล้ว +2

      @@RedhwanNacef thanks mate 👍... that clarifies my doubt

  • @bhuvaneshsankaran7670
    @bhuvaneshsankaran7670 3 ปีที่แล้ว

    Can we can manage the Pull Request by updating submodule from main repo ?

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว

      If I understand you correctly, yes. Because you can update and push any branch from the main repo, then any PR connected will be updated accordingly.

  • @karankundar7276
    @karankundar7276 ปีที่แล้ว

    Can i update multiple destination repositories with one source repository while executing some git submodules command at the source repository ?

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน

      "git submodule update --remote" might be what you are looking for?

  • @EdwinFairchild
    @EdwinFairchild 2 ปีที่แล้ว

    howcome everytime i run submodules update, i go look at my submodule and it checksout the commit (now outdated) that i originally made the project with....thought update would fetch the latest commit for me. So im finding to stay up to date I have to go checkout main from my submodule. How to I make my submodule always update to main not the commit i started my repo with

    • @RedhwanNacef
      @RedhwanNacef  2 ปีที่แล้ว

      I believe submodule update will only update according to the local remote. Have you tried adding the --remote flag? That should actually fetch and update for you (making the submodule is on the main branch too).

  • @windmaomao
    @windmaomao ปีที่แล้ว

    Thanks for the video. However I think the real trouble is at the Pull Request, for instance, how do you take a look at the commits of one repo without another repo, and it seems to me you have to have two Pull Request from two repos to be merged in at the SAME time? isn't this crazy?

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน

      You're welcome. The idea is that these should still move independently. So you or someone else may work on the module separately. Then once ready you would make changes to the parent repo. This is the same workflow as working with an external library, just without the need of maintaining and publishing versions. Hope that makes sense.

  • @anonanon3066
    @anonanon3066 3 ปีที่แล้ว

    Can i "check out" a single directory?
    Let's say i just want the "source" directory of another repository. I don't need all the other mambo jambo such as tests or documentation or readmes, but still have the possibility to keep it up to date via git

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว

      Hmm, I don't think that is possible unfortunately, I believe it is just full repositories.

  • @meerasridhar9570
    @meerasridhar9570 3 ปีที่แล้ว

    can we modify the codes in submodules. i have a repo with submodule pointing to other repo.i want to modify some codes in submodule in my repo only.i dont want to alter the code of the repo it is pointing to. Repo1 has submodule 1. submodule1 is pointing to Repo2 commits. now i want to modify the submodule1 in the Repo1 only not in Repo2

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว +1

      I think this is doable but not in the way you have suggested, i.e. you cannot add changes for the submodule and store them in Repo1, because Repo1 does not track any changes to the submodule other than the commit it is pointing to. An approach could be to create a a branch in a fork of repo 2 for example. That way you can have your code/commits there without altering the original repo, but this means you will have to manually ensure any new updates are merged/rebased on top of your custom changes. There may be other ways of achieving what you want without modifying the code directly but this is completely depending on the structure of the repo itself. Hope this helps.

  • @ashwinswain1649
    @ashwinswain1649 ปีที่แล้ว +1

    Hi,
    I am not able to see the submodule files i guess now i got the answer why.....thanks for that..but what if i want to undo and make it invisible again?
    also how can i add a version tag to the submodules and how can i use a feature branch of repo A as a submodule inside repo B so i can run a github action on B

    • @RedhwanNacef
      @RedhwanNacef  11 หลายเดือนก่อน

      You're welcome. I wonder if the "deinit" command is what you are looking for here? Tags would be added the same as any other repo. In terms of feature branch you can specify the branch in the .gitmodules file. Hopefully that helps!

  • @realscreen7735
    @realscreen7735 ปีที่แล้ว +2

    U made some changes to the local repo and comitted them from which u got the submodule. How is git able to figure out that there are changes in the local repo when it is pointing to the remote url and not the local repo from which we got the submodule?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      Good question, if you remember we have a ".gitmodules" that has a path to the submodule. This is telling git where to track the local changes. This is how it knows there are changes in the local repo. Hope that makes sense.

  • @eduardojreis
    @eduardojreis 2 ปีที่แล้ว +1

    9:36 - Showing the branch in the command line prefix is very clever. How do you do that? Is that automatic? I am under anaconda, so I get to see the environment name, not the git branch name. Cheers,

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      I am using a shell called 'Zsh' with 'Oh My Zsh' will lets you configure/customise all of this. It's very useful.

  • @okey1317
    @okey1317 ปีที่แล้ว

    is it possible to configure my submodule so that it always points to the latest commit on a specific branch?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      You can add a branch property to the .gitmodules file (e.g. "branch = some-branch"). By default it is pointing to the default branch of the repo. I think that might be what you are looking for.

  • @baatar
    @baatar 4 หลายเดือนก่อน

    9:00 if you have cloned your git repo but need to install the submodule, the command is "git submodule update --init"

  • @aelgames8889
    @aelgames8889 3 ปีที่แล้ว

    Hi there , can you create a new branch ... and try to edit any fiele on the git sobmodules .. and than pusch it ... iits not works for me ?

    • @RedhwanNacef
      @RedhwanNacef  3 ปีที่แล้ว

      If I understand you correctly, that will not work. When you edit a file in the sub repository, the changes wont be reflected in the root repository, only in the submodule itself. Does that help?

  • @misohoongry
    @misohoongry 2 ปีที่แล้ว

    Hi quick qn, what is the ide youre using in 3:52?

  • @philomenasung7394
    @philomenasung7394 2 ปีที่แล้ว

    May I know how do you show all the commands at 4:11?
    Also may I know what IDE is this?

    • @RedhwanNacef
      @RedhwanNacef  ปีที่แล้ว

      I was using the 'ZSH' shell with the git plugin. So when I tab it shows recommendations. (I use Fish shell now). It is IntelliJ IDEA.