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 comm
By default the ResetCommand
resets to HEAD. To reset to another branch, you need to specify this branch with setRef()
.
For example:
git.reset().setMode(ResetType.HARD).setRef("refs/heads/level1").call();
The above command will let the current branch point to the latest commit of level1
and checkout its state into the work directory .