 
      Gems from git repositories
Bundler has the ability to install gems directly from git repositories. Installing a gem using git is as easy as adding a gem to your Gemfile.
                        Note that because RubyGems lacks the ability to handle gems from git, any gems
                        installed from a git repository will not show up in gem list.
                        They will, however, be available after running Bundler.setup.
                      
gem 'rack', :git => 'https://github.com/rack/rack'
gem 'nokogiri', '1.7.0.1', :git => 'https://github.com/sparklemotion/nokogiri'
git 'https://github.com/rails/rails.git' do
  gem 'railties'
  gem 'actionpack'
  gem 'activemodel'
end
git 'https://github.com/rails/rails.git', :ref => '4aded' do
git 'https://github.com/rails/rails.git', :branch => '5-0-stable' do
git 'https://github.com/rails/rails.git', :tag => 'v5.0.0' do
gem 'nokogiri', :git => 'https://github.com/rack/rack.git', :ref => '0bd839d'
gem 'nokogiri', :git => 'https://github.com/rack/rack.git', :tag => '2.0.1'
gem 'nokogiri', :git => 'https://github.com/rack/rack.git', :branch => 'rack-1.5'
gem 'rack', :git => 'https://github.com/rack/rack.git'
gem 'rack', :git => 'git@github.com:rack/rack.git'
gem 'rack', :git => 'git://github.com/rack/rack.git'
gem 'rugged', :git => 'git://github.com/libgit2/rugged.git', :submodules => true
gem 'rack', :github => 'rack/rack'
gem 'rails', :github => 'rails'
gem 'rails', :git => 'https://github.com/rails/rails'
:git options apply, like :branch and :ref.
                    gem 'rails', :github => 'rails', :ref => 'a9752dcfd15bcddfe7b6f7126f3a6e0ba5927c56'
:bitbucket) and GitHub Gists (:gist).
                    gem 'capistrano-sidekiq', :github => 'seuros/capistrano-sidekiq'
gem 'keystone', :bitbucket => 'musicone/keystone'
Custom git sources
:github shortcut used above is one of Bundler's built in git sources. Bundler comes
                      with shortcuts for :github, :gist, and :bitbucket, but you can
                      also add your own.
                    git_source before you use your custom option. Here's an example for Stash:
                    git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
gem 'rails', :stash => 'forks/rails'
Security
http:// and git:// URLs are insecure. A
                      man-in-the-middle attacker could tamper with the code as you check it out,
                      and potentially supply you with malicious code instead of the code you meant to
                      check out. Because the :github shortcut uses a git://
                      URL in Bundler 1.x versions, we recommend using HTTPS URLs or overriding
                      the :github shortcut with your own HTTPS git source.
                    Local Git Repos
$ bundle config local.GEM_NAME /path/to/local/git/repository
$ bundle config local.rack ~/Work/git/rack
gem 'rack', :github => 'rack/rack', :branch => 'master'
                        Now instead of checking out the remote git repository, the local
                        override will be used. Similar to a path source, every time the local
                        git repository change, changes will be automatically picked up by
                        Bundler. This means a commit in the local git repo will update the
                        revision in the Gemfile.lock to the local git repo revision. This
                        requires the same attention as git submodules. Before pushing to
                        the remote, you need to ensure the local override was pushed, otherwise
                        you may point to a commit that only exists in your local machine.
                      
                        Bundler does many checks to ensure a developer won't work with
                        invalid references. Particularly, we force a developer to specify
                        a branch in the Gemfile in order to use this feature. If the branch
                        specified in the Gemfile and the current branch in the local git
                        repository do not match, Bundler will abort. This ensures that
                        a developer is always working against the correct branches, and prevents
                        accidental locking to a different branch.
                      
                        Finally, Bundler also ensures that the current revision in the
                        Gemfile.lock exists in the local git repository. By doing this, Bundler
                        forces you to fetch the latest changes in the remotes.
                      
If you do not want bundler to make these branch checks, you can override it by setting this option:
$ bundle config disable_local_branch_check true