diff --git a/Gemfile b/Gemfile
index e679f3ee1aa353cf8e3941ee348c6c55f96ff03e..f5e05a1c8ebd7e83af0356f1b993e07a4615700a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,7 @@ gem 'omniauth-github'
 
 # Extracting information from a git repository
 # Provide access to Gitlab::Git library
-gem 'gitlab_git', '~> 1.4.1'
+gem 'gitlab_git', path: '../gitlab_git'#'~> 1.4.1'
 
 # Ruby/Rack Git Smart-HTTP Server Handler
 gem 'gitlab-grack', '~> 1.0.1', require: 'grack'
diff --git a/Gemfile.lock b/Gemfile.lock
index 6eedadc74c6c2d6c216aac25ce52cb11ef455067..444a3dc8ba1c73f9df771df5464366dd2753716c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -12,6 +12,14 @@ GIT
   specs:
     raphael-rails (2.1.0)
 
+PATH
+  remote: ../gitlab_git
+  specs:
+    gitlab_git (1.4.1)
+      activesupport (~> 3.2.13)
+      github-linguist (~> 2.3.4)
+      gitlab-grit (~> 2.6.0)
+
 GEM
   remote: https://rubygems.org/
   specs:
@@ -176,10 +184,6 @@ GEM
     gitlab-pygments.rb (0.3.2)
       posix-spawn (~> 0.3.6)
       yajl-ruby (~> 1.1.0)
-    gitlab_git (1.4.1)
-      activesupport (~> 3.2.13)
-      github-linguist (~> 2.3.4)
-      gitlab-grit (~> 2.6.0)
     gitlab_meta (6.0)
     gitlab_omniauth-ldap (1.0.3)
       net-ldap (~> 0.3.1)
@@ -275,7 +279,7 @@ GEM
     minitest (4.7.4)
     modernizr (2.6.2)
       sprockets (~> 2.0)
-    multi_json (1.7.7)
+    multi_json (1.7.8)
     multi_xml (0.5.4)
     multipart-post (1.2.0)
     mysql2 (0.3.11)
@@ -568,7 +572,7 @@ DEPENDENCIES
   gitlab-gollum-lib (~> 1.0.1)
   gitlab-grack (~> 1.0.1)
   gitlab-pygments.rb (~> 0.3.2)
-  gitlab_git (~> 1.4.1)
+  gitlab_git!
   gitlab_meta (= 6.0)
   gitlab_omniauth-ldap (= 1.0.3)
   gon
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 2a476355404635887d820e73be1c3db1d7b0a337..9cd883f421b2871fb66b4a69c60cd197be309b69 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -137,7 +137,7 @@ class MergeRequest < ActiveRecord::Base
   end
 
   def unmerged_diffs
-    project.repository.diffs_between(source_branch, target_branch)
+    Gitlab::Git::Diff.between(project.repository, source_branch, target_branch)
   end
 
   def last_commit
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 588cabfbae024e2dfd2007122d17524ed3c21444..cd33782a4cc18a5cdd05c97fc940921a51bd0cb8 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -18,19 +18,25 @@ class Repository
   end
 
   def commit(id = nil)
-    commit = raw_repository.commit(id)
+    commit = Gitlab::Git::Commit.find(raw_repository, id)
     commit = Commit.new(commit) if commit
     commit
   end
 
   def commits(ref, path = nil, limit = nil, offset = nil)
-    commits = raw_repository.commits(ref, path, limit, offset)
+    commits = Gitlab::Git::Commit.where(
+      repo: raw_repository,
+      ref: ref,
+      path: path,
+      limit: limit,
+      offset: offset,
+    )
     commits = Commit.decorate(commits) if commits.present?
     commits
   end
 
-  def commits_between(target, source)
-    commits = raw_repository.commits_between(target, source)
+  def commits_between(from, to)
+    commits = Gitlab::Git::Commit.between(raw_repository, from, to)
     commits = Commit.decorate(commits) if commits.present?
     commits
   end
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index a81c80cfc6f2cd62f26a055b00ca4b0c62720dd4..d1035240cb62b255c1088b2a942e668b476540c3 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -95,13 +95,9 @@ module ExtractsPath
   # resolved (e.g., when a user inserts an invalid path or ref).
   def assign_ref_vars
     @id = get_id
-
     @ref, @path = extract_ref(@id)
-
     @repo = @project.repository
-
     @commit = @repo.commit(@ref)
-
     @tree = Tree.new(@repo, @commit.id, @ref, @path)
     @hex_path = Digest::SHA1.hexdigest(@path)
     @logs_path = logs_file_project_ref_path(@project, @ref, @path)