[toc] I am writing few methods to fix git detached head with origin/master taken from stack overflow given in various answers.…