title: How to hard reset from one git branch to other in JGit?
body: <p>I have two branches one is master and another one level1. Now level1 is the latest I need to hard reset master to level1 normally in git bash I can do that by following command.</p>
  
  <pre><code>$ git checkout master
  $ git tag old-master-branch 
  $ git reset --hard level1
  $ git merge -s ours origin/master 
  $ git push origin master
  </code></pre>
  
  <p>This one works fine for me. My question is how can I achieve it by using JGit. I have tried it. But I am not able to figure out how to set the source and target branch.</p>
  
  <p>consider a scenario I have cloned a master branch</p>
  
  <pre class="lang-java prettyprint-override"><code> Git git = Git.cloneRepository().setURI(remote).setCredentialsProvider(new UsernamePasswordCredentialsProvider("obuli", "xxxxxx")).setDirectory(gitPath)                    .setNoCheckout(true).call();
  </code></pre>
  
  <p>Now I need to hard reset it to the level1.</p>
  
  <pre class="lang-java prettyprint-override"><code>git.reset().setMode(ResetType.HARD).call();
  </code></pre>
  
  <p>But here I am not specifying level1 . I dont know how to specify it. and also please say how to provide <code>git merge -s ours origin/master</code> in JGit</p>