Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Git Best Practices Guide

You're reading from   Git Best Practices Guide Master the best practices of Git with the help of real-time scenarios to maximize team efficiency and workflow

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781783553730
Length 102 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
PIDOUX Eric PIDOUX Eric
Author Profile Icon PIDOUX Eric
PIDOUX Eric
Arrow right icon
View More author details
Toc

Managing Git submodules


You will probably work on a project that requires dependency on another project. This can be a library that was developed by you or another team. It can be hard to manage when the library is updated and you made some custom code inside your project.

Git handles this by using submodules. It allows you to manage a Git repository as a subfolder of another Git repository, which in turn lets you clone a repository isolated from the commits of the current repository.

Adding a submodule

Let's imagine you are working on a website and you want to add the fpdf library that helps you create a PDF file in PHP. The first thing to do is to clone the library's Git repository inside your subfolder:

Erik@server:~/mySite/$ git submodule add https://github.com/lsolesen/fpdf.git fpdf
Cloning in 'fpdf'
remote: Counting objects: 966, done.
remote: Total 966 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (966/966), 5.96 MiB | 1.13 MiB/s, done.
Resolving deltas: 100% (292/292), done...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image