git
command line options for automating common rebasing tasks, like adding a fix to a commit that was already rebased into the history.
Reminder of what you can do with Geordi.
Note: If you alias Geordi to something short like g
, running commands gets much faster!
Note: You only need to type the first letters of a command to run it, e.g. geordi dep
will run the deploy
command.
Guided deployment, including push, merge, switch branches. Does nothing without confirmation.
Run something for all Capistrano environments, e.g. geordi cap deploy
When you just clon...
First find the reference for the entry you want through looking at the stash:
$ git stash list
stash@{0}: WIP on feature/foo
stash@{1}: WIP on feature/bar
stash@{2}: WIP on fix/baz
Now you can simply use that reference, but curly braces must be escaped:
git stash pop stash@\{1\}
or quoted:
git stash apply "stash@{1}"
Sometimes huge refactorings or refactoring of core concepts of your application are necessary for being able to meet new requirements or to keep your application maintainable on the long run. Here are some thoughts about how to approach such challenges.
Try to break your refactoring down in different parts. Try to make tests green for each part of your refactoring as soon as possible and only move to the next big part if your tests are fixed. It's not a good idea to work for weeks or months and wait for all puzzle pieces ...
So you're getting this failure when running bundle install
on an older project:
Your Gemfile.lock is corrupt. The following gems are missing from the DEPENDENCIES section: 'archive-tar-minitar' 'hoe' 'rcov'
This happens when you are using a new version of Bundler with a project that was bundled with a very old version of Bundler. For reasons unknown, the Bundler dependency API returns different dependencies for some gems (like ruby-debug
or rainpress
) than the dependencies found in the downloaded gemspecs. While old versi...
When running tests via parallel_tests, you may encounter an error:
cannot load such file -- parallel_tests/gherkin/runtime_logger
Error creating formatter: ParallelTests::Gherkin::RuntimeLogger (LoadError)
This will happen when you upgrade Bundler to version 1.13.x and appears to be "by design" since there is a Bundler config option to restore previous behavior.
You can fix it by setting that flag. You should commit the resulting config file into the repository!
bundle config --local disable_exec_load true
There is a Git...
In order to have monitoring for Sidekiq (like queue sizes, last run of Sidekiq) your application should have a monitoring route which returns a json looking like this:
{
"sidekiq": {
"totals": {
"failed": 343938,
"processed": 117649167
},
"recent_history": {
"failed": {
"2016-11-06": 1,
"2016-11-07": 46,
"2016-11-08": 0,
"2016-11-09": 0,
"2016-11-10": 0
},
"processed": {
"2016-11-06": 230653,
"2016-11-07": 230701,
"2016-11-08"...
When working with custom transactions and use ActiveRecord::Rollback
you may encounter unexpected behaviour if you try to roll back your changes.
When using nested transactions, ActiveRecord::Rollback
might not do what you expect, since it will only roll back the inner, but not the outer transaction.
You can fix this behavior by using transaction(joinable: false)
but this leads to a bunch of different problems.
When you don't need an explicit ActiveRecord::Rollback
, don't worry about any of this and just use a plan `tran...
If you are fine with the default console diff most of the time but only sometimes want to use an external tool for viewing a diff, you can use git difftool
.
E.g. viewing git diff
with meld:
git difftool --tool=meld
For each file in the diff you will be asked if you want to view it using meld.
If you want to find the commits that touched a specific text in a file, use
git log -S 'text in the code' -- path/to/file
If you use tig you may run a similar command to get a navigatable list of affected files:
tig -S'text in the code'
Here is an example, where the move of the convert_number_column_value(value)
method in active record is traced (simplified output):
git log -n 1 --pretty=oneline -S 'convert_number_column_value(value)' -- activerecord/lib/active_record/base.rb
ceb33f84933639d3b6...
Using the -U
parameter you can change how many lines are shown above and below a changed section.
E.g. git diff -U10
will show 10 lines above and below.
You might get the above error message when cloning certain git repositories (for example the rails repository). It indicates that there is a malformed timestamp in some commit, and your git installation is configured to validate it.
As a workaround, you can disable the validation using
git config --global fetch.fsckobjects false
This settings seems to be the default for most git installations anyways.
We have released a new library Gemika to help test a gem against multiple versions of Ruby, gem dependencies and database types.
Here's what Gemika can give your test's development setup (all features are opt-in):
Similar to our snippet that runs all Cucumber features matching a given string, the following will run all modified or new Cucumber features by looking at your git status:
git status --short | grep -v '^ D ' | grep '.feature' | sed 's/.. //' | tr '\n' ' ' | xargs geordi cucumber
If you want to know what each of the above commands does, see [explainshell](http://explainshell.com/explain?cmd=git+status+--short+%7C+grep+-v+%27%5E+D+%27+%7C+grep+%27.feature%27+%7C+sed+%27s%2F..+%2F%2F%27+%7C+tr+%27%5Cn%27+%27+%27+%7C...
Git is hard: screwing up is easy, and figuring out how to fix your mistakes is fucking impossible. Git documentation has this chicken and egg problem where you can't search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem.
Maybe this flowchart may be of help...
You want Spring for super-fast binstubs like bin/rails
or bin/rspec
which avoid Rails boot time.
You want parallel_tests to speed up full test runs of large test suites.
Unfortunately, you do not want parallel_tests to use your Spring binstubs as those parallelized tests will share data and/or loose some information. There are some issues about this on GitHub and there is a suggested [workaround](https:...
Sometimes you might need to nest a git-project inside another git-project. The right strategy is to use submodules in this case.
sha
as its referenceHere is how you add a nested project inside your parent project
$ git submodule...
When you run rake db:rollback
and nothing happens, you are probably missing the latest migration file (or have not migrated yet).
$ rake db:rollback
$
If that happens to you, check your migration status.
$ rake db:migrate:status
up 20160503143434 Create users
up 20160506134137 Create pages
up 20160517112656 Migrate pages to page versions
up 20160518112023 ********** NO FILE **********
When you tell Rails to roll back, it tries to roll back the latest change that was mi...
If you're trying to searching or installing packages via pkg
the your repository data might be broken. If pkg update
shows that your repositories are up to date try:
pkg update -f
Afterwards you should be able to search and install packages again.
Instead of using this hack you might want to use MariaDB 10.x which can work with both old and new apps.
An alternative could be to use the MySQL Docker image which is still updated for 5.6.
Ubuntu 16.04 only provides packages for MySQL 5.7 which has a range of backwards compatibility issues with code written against older MySQL versions.
Oracle maintains a list of official APT repositories for MySQL 5.6, but those repositories do...
Tool to show you which gems are slow to load:
➜ git:(master) ✗ bundle exec bumbler
[################################################# ]
(49/65) travis-lint...
Slow requires:
110.21 render_anywhere
147.33 nokogiri
173.83 haml
179.62 sass-rails
205.04 delayed_job_active_record
286.76 rails
289.36 mail
291.98 capistrano
326.05 delayed_job
414.27 pry
852.13 salesforce_bulk_api
Git commands tend to come in groups. Avoid typing git over and over and over by running them in a dedicated git shell.
You might want to run git config --global help.autocorrect true
before using gitsh
. This will silently swallow a muscle-memory "git" prefix to your commands inside the git shell.
Enter any command into explainshell and it will explain it to you: split into separate commands (if present), with each option explained.
Hello,
This site contains 29761 parsed manpages from sections 1 and 8 found in Ubuntu's manpage repository. A lot of heuristics were used to extract the arguments of each program, and there are errors here and there, especially in manpages that have a non-standard layout.
It is written in Python and uses bashlex, a bit of NLTK (to find the interesting parts of the manpage), a little d3....
First, decide if you want to pull with rebase. There are some implications of changing this, so think before you do it.
If you do, you can tell git to stash automatically before pulling:
git config --global rebase.autoStash true
Now on pull
, git will a) stash, b) pull and c) reapply your working tree. Note that applying your changes may lead to unresolvable conflicts!
Further see a common git config with this configuration enabled.