Skip to content

Instantly share code, notes, and snippets.

@claudius108
claudius108 / git.md
Last active May 10, 2023 16:59 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository

RECREATE A REPO WITH ONLY THE CONTENT

Remove the history

rm -rf .git

recreate the repo from the current content only

git init git add . git commit -m "Initial commit"

push to the github remote repos ensuring you overwrite history

/*
This script uses Oxygen operation called JSOperation, see https://www.oxygenxml.com/doc/versions/18.0/ug-editorEclipse/topics/dg-default-author-operations.html.
For generating the personal access token to be used in this script, please select "public_repo | Access public repositories".
This script has to be put in the file ${framework}/commons.js.
In order to add the button for publishing to github, add the following code to any CSS file that is associated within the framework with the edited XML file:
rdf|RDF:before {
content: oxy_button(action, oxy_action(name, "Publish to github", operation, "ro.sync.ecss.extensions.commons.operations.JSOperation", arg-script, "function doOperation(){publishToGihub();}"))
}
*/
xquery version "3.1";
import module namespace http = "http://expath.org/ns/http-client";
(: For generating the personal access token to be used in this script, please select "public_repo | Access public repositories". :)
let $git-token := "<your-github-token>"
let $user-name := "<your-github-username>"
let $repo-name := "<your-repo-name>"
let $file-path := "<file=path>"
let $message := "<commit-message>"
let $new-file-content := serialize(<a/>)
authorEditorAccess.addAuthorCaretListener(new AuthorCaretListener() {
@Override
public void caretMoved(AuthorCaretEvent caretEvent) {
AuthorNode currentNode = caretEvent.getNode();
if (currentNode.getType() != AuthorNode.NODE_TYPE_ELEMENT) {
return;