Git - clone repository and set it to a orphaned commit

703 Views Asked by At

Everytime a commit is pushed in a Stash repository, a build in triggered in our build system. However, sometimes, people do a rebase of that commit, so it is not contained in a branch anymore.

Our build system does a clone of the repository, then the command:

git reset --hard <sha>

However, the command fails since the clone seems to get the list of commits of the branch, and the commit is not contained in the branch anymore, even if the commit still exists when trying to access it in Stash.

Is there a way to fetch that specific commit so that the system can build the code from the commit that is orphaned?

0

There are 0 best solutions below