Skip to content

Instantly share code, notes, and snippets.

View mikemichaelis's full-sized avatar

Mike Michaelis mikemichaelis

View GitHub Profile
@mikemichaelis
mikemichaelis / git core.askpass
Created January 5, 2012 15:00
When using Git HTTPS set core.askpass to git-gui--askpass this will pop up a window prompting you for your password.
$ git config --global core.askpass /usr/libexec/git-core/git-gui--askpass
@mikemichaelis
mikemichaelis / gist:1583437
Created January 9, 2012 15:34
NLog config to log output formatted to log4j XML (includes xml header and namespace)
<target xsi:type="File" name="file" fileName="file.xml">
<layout xsi:type="LayoutWithHeaderAndFooter">
<header xsi:type="SimpleLayout" text="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;root xmlns:log4j=&quot;http://jakarta.apache.org/log4j/&quot;&gt;"/>
<layout xsi:type="Log4JXmlEventLayout" />
<footer xsi:type="SimpleLayout" text="&lt;/root&gt;"/>
</layout>
</target>
@mikemichaelis
mikemichaelis / gist:4953869
Created February 14, 2013 16:14
WPF 3.5 SP1 feature: StringFormat
http://blogs.msdn.com/b/llobo/archive/2008/05/19/wpf-3-5-sp1-feature-stringformat.aspx
@mikemichaelis
mikemichaelis / gist:5265989
Created March 28, 2013 19:15
Stretch ListBox Item Content
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
</Style>
</ListBox.ItemContainerStyle>
typings
app/**/*.js
app/**/*.map
node_modules
jspm_packages
bower_components
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<h1>hello, world</h1>
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true
http://stackoverflow.com/questions/2763006/change-the-current-branch-to-master-in-git
The problem with the other two answers is that the new master doesn't have the old master as an ancestor, so when you push it, everyone else will get messed up. This is what you want to do:
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch # fast-forward master up to the merge
If you want your history to be a little clearer, I'd recommend adding some information to the merge commit message to make it clear what you've done. Change the second line to:
If you have the master branch checked out locally, you can also do it in two simpler steps: First reset the branch to the parent of the current commit, then force-push it to the remote.
$ git reset HEAD^ --hard
$ git push mathnet -f
@mikemichaelis
mikemichaelis / gist:6d20a5dc8a02223b991b0680504d4a9f
Last active November 16, 2016 01:14
Create a publish branch with a single commit
git pull origin master
git checkout master
git checkout --orphan publish
git commmit -a -m "Initial commit"
git push origin publish