$ git merge -Xours branch-name $ git merge -XTheirs banch-name
Comes in really handy for sweeping updates, like running eslint --fix on an entire code base or merging package-lock.json.
<アンダブロッブ />
$ git merge -Xours branch-name $ git merge -XTheirs banch-name
Comes in really handy for sweeping updates, like running eslint --fix on an entire code base or merging package-lock.json.
Git command line is pretty confusing. Here are some aliases that I found helpful that normalize it with other command line commands and add a little bit better context.
Open global .gitconfig file:
$ open ~/.gitconfig
If there isn’t an [alias] section already, add one:
[alias] cd = checkout ll = branch ls = branch delete-merged = !git branch --merged | egrep -v \"(^\\*|master|development)\" | xargs git branch -d mk = checkout -b new-up = !git push -u origin `git symbolic-ref --short HEAD` stage = add unstage = reset HEAD
Update 2018-07:
To set VS Code as the default editor for commit and merge messages:
[core] editor = code --wait
Here they are for not forgetting:
ES6 introduced Object.entries and destructuring and template strings:
for (let [key, val] of Object.entries(myObjectPrimitive)) {
console.log(`myObjectPrimitive[${key}]: ${val}`);
}
Through courage and discipline, we will be the masters of our own fate
CSS can only add ellipsis to a single line of text. Here’s how to do it in Javascript using lodash:
// Update wrapping text to limit the number of lines.
var maxLines = 2;
var textEls = document.getElementsByClassName('text-els-class');
var textMaxH = Math.ceil(textEls[0].getBoundingClientRect().height) * maxLines;
_.forEach(textEls, function(el) {
el.style.whiteSpace = 'normal';
var elH = el.getBoundingClientRect().height;
var isOverflow = elH > textMaxH;
var text = el.innerHTML;
// Remove the last word until the height is within bounds.
while (elH > textMaxH) {
text = (text
.split(' ')
.slice(0,-1)
.join(' ')
);
el.innerHTML = text;
elH = el.getBoundingClientRect().height;
}
if (isOverflow) {
title.innerHTML += ' ...';
title.style.maxHeight = titleMaxH + 'px';
}
});
Shake St. Germain over ice and pour into the cider.