Find out when a keyword (method name, constant) is added or removed in git
When refactoring it is sometimes useful to see when a method or constant was introduced or removed.
git log -G'method_name'
git log -G'ConstantName'
If you see that a method is no longer used then you are safe to remove it. You can also see the context around why it was added which could make it easier to refactor.
Related cards:
The seven rules of a great git commit message
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use...
NFS is reporting that your exports file is invalid (Issue starting vagrant box)
when trying to vagrant up
I got the following error:
NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":
exports:...
rebasing changes from a development branch onto another branch
If you have changes on a branch which you want to apply to another branch which has a different history you might not want to merge or rebase. This method allows you to identify a series of commits and replay them onto your destination branch. For...
Squash my last X commits together using Git
You can do this fairly easily without git rebase
or git merge --squash
. In this example, we'll squash the last 3 commits.
If you want to write the new commit message from scratch, this suffices:
git reset --soft HEAD~3 && git commit
If ...
Run a single test in Test::Unit
To run a single test file:
rake test:units TEST=test/unit/post_test.rb
rake test:functionals TEST=test/functional/posts_controller_test.rb
rake test:integration TEST=test/integration/admin_news_posts_test.rb
You may even run a single...
Getting started with Git Log
The easy option:
git log --graph --decorate --oneline
-
--graph
draws a graph indicating commits (implies --topo-order) -
--decorate
shows any ref names (tags and branches) -
--oneline
shows the start of the commit sha and the commit tit...
Let's Encrypt certificate install/renew issues
There are various reasons why a Let's Encrypt certificate can't be installed or renewed. Here are some I've come across:
Error:
Not documented, add it if you have it
Issue:
The stack is behind a load balancer and traffic is being s...
Rails: NoMethodError: undefined method `config' for nil:NilClass
While trying to upgrade from Rails 3.2 to 4.0 I had this problem when starting the app:
NoMethodError: undefined method `config' for nil:NilClass
/var/lib/gems/1.9.1/gems/railties-4.0.13/lib/rails.rb:32:in `configuration'
/var/lib/gems/1.9.1/...