![]() So now the parent must be looking like this: Once you move all files of content folder, delete the folder from the parent Now I want to see a 404 error when someone tries to access content folder so keeping that in mind I will make my new repo a private one but you can chose any, depending on your needs. The first thing to do now is create a new repository and move all the files of content folder into Replacing a folder with submoduleĪnd you want to restrict content folder for some reason while keeping the repo functional. ![]() TL DR: The folder that we want to restrict, is going to be converted into a whole new repository and then we are only going to be referencing that repo as a submodule to our main repositoryįrom here on out I’ll be calling main repository as a parent repo and the files that we decided to put in a different repo will be called as child repo. It does not have an inbuilt feature that we can just use it, we can either make the repo private or we can keep it all open.īut there is trick to it and our main ingredient is going to be Git submodules. Restricting some of the folders in your github repository isn’t something Github has provided us with. If you would like, she has also wrote an article about this and you can read it here. The whole thing here is my thought process on how I implemented the same thing i.e. So I went to github, looked at the repo and clicked on content folder, I got a 404 error and that’s how I came to know about submodules Her website is amazing, filled with lots of articles and I being a curious one, wanted to take a look under the hood and after cloning the code I realized that somehow the files inside the content folder isn’t downloaded. Lib – where all the libraries a.k.a dependencies are stored which my source code is using.My first encounter with restricting a folder on github is when I tried to clone Tania Rascia’s website. Src – where my main source code is stored So I’ve created a new git project namely “hello-world” on my GitHub account, which has two directories: This obviously works if you use git for your software project version control. You can add as many submodules in your project as you want and assign rules such as “where to fetch it from” and “where to store the code once it is fetched”. This means your project will follow a modular approach and you can update the submodules, independent of your main project. Git has this feature baked in which allows you to add other git repos (dependencies projects) as submodules. Is this the best way of doing it, one may ask? But what happens when the author of “ print” makes some changes to its code or fixes a bug?Since you’ve used your own local copy of print and there is no tracking to the upstream project, you won’t be able to get these new changes in, therefore you need to manually patch it yourself or re-fetch and push the code once again. This works and everything runs as expected. Let us assume your project name “ hello-world” depends on an open source library called “ print”.Ī not-so-great way to manage the project is to clone the “print” library code and push it alongside the “Hello World” code tree to GitHub (or any version control server). As the name suggests it is built right into git itself, which is the de facto version control system for the majority of software projects. While there are a variety of ways and frameworks to manage software dependencies, depending on software complexity, today I’ll cover one of the most common and easy to use methods called “ git submodule”. This is a classic example of how dependencies play a huge role in software lifecycle and why managing them efficiently becomes important. log4jt was a dependency in a variety of software and the vulnerabilities discovered affected all of them. This ensures that a small change breaks nothing and your project is not outdated and does not have any known security vulnerability or bugs.Ī good recent example of this is log4j, a popular framework for logging, initially released in 1999, which became a huge headache for many businesses at the end of 2021, including Apple, Microsoft and VMware. These dependencies are also evolving, and need to be updated and in sync with your main source tree. Sooner than later developers can find their code depending on software projects of other developers which are either open source, hosted online or being developed in-house, in maybe another department of the organisation. But these frameworks and libraries become dependencies of our projects, and as the software grows in complexity over time, it can become pretty challenging to efficiently manage these dependencies. Frameworks and libraries have made developers’ lives so easy that there’s no need to reinvent the wheel anymore when it comes to software development. Rarely any software project today is built from the ground up.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |