git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
pub fn header(otext, divider string) string { | |
cols, _ := get_terminal_size() | |
mut text := otext | |
if text.len > 0 { | |
text = ' $text ' | |
} | |
// clip the text if it is too long | |
text = if cols > text.len + 1 + 2*divider.len { text } else { text[0..cols-(1+2*divider.len)] } | |
// make the text align with the terminal size: | |
if (text.len % 2) != (cols % 2 ) { |
// Since ES6 Map()'s' retain their order of insertion, it can sometimes be useful to get the last item or value inserted: | |
export const getLastItemInMap = map => Array.from(map)[map.size-1] | |
export const getLastKeyInMap = map => Array.from(map)[map.size-1][0] | |
export const getLastValueInMap = map => Array.from(map)[map.size-1][1] | |
// Obviously getLastKey and getLastValue can reuse getLastItem, but for maximum portability I opted for verbosity. |
/** | |
* Given a source directory and a target filename, return the relative | |
* file path from source to target. | |
* @param source {String} directory path to start from for traversal | |
* @param target {String} directory path and filename to seek from source | |
* @return Relative path (e.g. "../../style.css") as {String} | |
*/ | |
function getRelativePath(source, target) { | |
var sep = (source.indexOf("/") !== -1) ? "/" : "\\", | |
targetArr = target.split(sep), |
var data = "do shash'owania"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(data).digest("hex"); |
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git |
#!/bin/bash | |
unset GIT_DIR | |
cd /path/to/project | |
# Get our info.... | |
LATEST_TAG=$(git describe --tags --abbrev=0) | |
CURRENT_REVISION=$(git describe) | |
NUMBER_FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG | wc -l) | |
#FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG) |
struct Sintf { | |
func fn() int | |
} | |
// Helper for calling the function | |
fn callf(p voidptr) int { | |
f := Sintf{ p }.func | |
return f() | |
} |
# Source: https://stackoverflow.com/questions/36358265/when-does-git-refresh-the-list-of-remote-branches | |
# To update the local list of remote branches: | |
git remote update origin --prune |
# Checkout the desired branch | |
git checkout <branch> | |
# Undo the desired commit | |
git revert <commit> | |
# Update the remote with the undo of the code | |
git push origin <branch> |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream