Skip to content

Instantly share code, notes, and snippets.

@mberrueta
mberrueta / git-recover-branch.md
Created September 21, 2017 20:56 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@mberrueta
mberrueta / bin-squash_migrations
Created May 10, 2018 15:27 — forked from bf4/bin-squash_migrations
Squash Rails migrations in this one easy step
#!/usr/bin/env bash
git ls-files db/migrate/*.rb | sort | tail -1 | \
ruby -e "schema_version=STDIN.read[/\d+/]; init_schema=%(db/migrate/#{schema_version}_init_schema.rb);
%x(git rm -f db/migrate/*.rb;
mkdir db/migrate;
git mv db/schema.rb #{init_schema};
rake db:migrate;
git add db/schema.rb; git commit -m 'Squashed migrations')"
@mberrueta
mberrueta / installing-emacs-from-source-on-debian.txt
Created February 2, 2024 03:02 — forked from zoliky/installing-emacs-from-source-on-debian.txt
Installing Emacs 29.1 from source on Debian 12
Installation
------------
1. Install the build dependencies for Emacs:
$ sudo apt build-dep emacs
$ sudo apt install libtree-sitter-dev
2. Download and unpack the Emacs archive: