1

There is a small library that I want to fork and modify and use in my project. (the modification will occur as I develop the project)

Since I use bower to manage javascript libraries, I'd like to use bower for the forked library as well.

If I make a modification to the library, how do I commit the modification to the forked github repository as well?

eugene
  • 39,839
  • 68
  • 255
  • 489
  • You can just specify the git url in your `bower.json`. See: http://stackoverflow.com/questions/20196707/can-i-add-a-git-repository-to-my-bower-json – univerio May 10 '14 at 01:13
  • yes I know I can download github-hosted libraries using bower, The question is, how should I modify and commit it to the repository? Can I modify the bower-downloaded code and commit it? if so how? – eugene May 10 '14 at 01:16
  • Yes, bower looks at the git tags in the repository. If you tag a commit as a higher semver as the latest, bower will pick that up. – univerio May 10 '14 at 01:17
  • How do I commit my modification back to the forked-github-repository? My original question's wording was confusing, and I edited it.. – eugene May 10 '14 at 01:22

1 Answers1

3

If I understood your question correctly, you're asking how to modify the copy in bower_components and then commit that back?

You can use bower link for that. First, clone your fork of the library:

git clone https://github.com/eugene/libfoo

Then, tell bower you have a local repository of libfoo:

cd libfoo
bower link

Finally, install a symlink to the library into your project:

cd myproject
bower link libfoo

If you inspect the bower_components directory, you will find that libfoo is a symlink to the cloned repo for libfoo, which you can commit and push as you like.

univerio
  • 19,548
  • 3
  • 66
  • 68