Force push
GitRoot protect some branches against force-push. Force-push is bad practice and should be avoided, especially on shared branch. By default GitRoot protect your defaultBranch.
To know if a branch is protected or not, look at the .gitroot/repoConfiguration.yml file.
1defaultbranch: main
2noforcepush:
3 - main
But sometimes we need to do bad things. GitRoot permit to edit this branch in a pretty cool workflow:
- Make the branch writable only by you. Edit
.gitroot/users.ymland remove all other users for this branch. Commit the diff and push it. By now, only you can change this branch. - Unprotect the branch. Remove the branch from the list of
noforcepushin.gitroot/repoConfiguration.yml. Commit and push. - Now you are the only one who can touch the branch and this branch is no more protected. Make all the modification you need in your git history. Don’t forget to delete the last 2 commits (the one where your delete all others owners and the one where you unprotect the branch).
- Push-force
- If all is good your repository has reactivated the protection against force-push and all others users can push on this branch again.