1

I've been trying to figure out how to do the following with Git:

So I have a website folder with a git repo and commits and everything. I've usually been downloading Bootstrap as a ZIP and extracting it into my repo. But there's upstream changes on Bootstrap's GitHub that I feel might be useful to pull in my project. I'd like to periodically fetch and merge their new version of bootstrap without having to re-download and re-commit bootstrap to my repo everytime there's a new big change.

So how do I go along taking Bootstrap's repo, cloning (?) in my project without having the hundreds of commits from Bootstrap cluttering up my history, and JUST fetch their upsteam changes?

Thanks so much!

rb612
  • 5,280
  • 3
  • 30
  • 68

1 Answers1

1

You can simply add the Bootstrap repo as a submodule of your own repo

git submodule add https://github.com/twitter/bootstrap.git
git add .gitmodules bootstrap
git commit -a -m "Added bootstrap submodule"
git submodule init
git submodule update

See for instance the blog posts:

It will appear as a subfolder, and will reference a fixed version.
You can also configure it to always update to the latest commit of a given branch if you want.

Your history won't be mixed with Bootstrap repo history.
And your repo size won't change (it only includes a gitlink entry, not the all repo)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250