Git shortcut to checkout recent branches
If you have
fzf
Show archive.org snapshot
installed, you may add an alias such as this to your ~/.bashrc
:
alias recent-branch="git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ | fzf | sed 's/\* //g' | xargs -I '{}' git checkout {}"
Now whenever you want to switch back and forth between your most recent branches, type recent-branch
, select one and press enter.
Related cards:
Customize tokenization of the MySQL FULLTEXT parser
The way MySQL's FULLTEXT tokenizer splits text into word tokens might not always be what you need. E.g. it splits a word at period characters.
Since the tokenizer has near-zero configuration options (minimum word length and stopwords list), you n...
How to push to Git without running CI on GitLab CI, GitHub Actions, or Travis CI
If a project ist configured to spawn CI runners for tests or deployment when pushing to the Repo, a habit of pushing WIP commits regularly may conflict with that.
Here are two solutions that allow you to keep pushing whenever you feel like it.
#...
Git shortcut to fixup a recent commit
git --fixup
is very handy to amend a change to a previous commit. You can then autosquash your commits with git rebase -i --autosquash
and git will do the magic for you and brin...
How to checkout submodules in Gitlab CI
Accessing other repositories in Gitlab CI is not straight forward, since the access rights of the current pipeline might not be sufficient enough.
One approach is to use project access tokens and clone the repositories via HTTPS.
- [Create a pro...
greckout - a bash script to grep and checkout your git branches
greckout query
This will list all branches matching your query as input options for git checkout
greckout ar
1) ar/cache-api-keys-1098
2) ar/add-categories-object-to-tv-show-1382
3) ...
Git shortcut to rebase onto another branch
Inspired by recent "git shortcut" cards I figured it would be nice to have one of these for rebasing a few commits onto another branch. The usual notation is prone to of-by-one errors as you have to either specify the commit before the ones you ...
Story Checklist Template
This is an story checklist I use to work on stories. For this purpose I extracted several cards related to the makandra process and ported them into a check list...
Git: Advisory for cherry-picks to production branches
We often have a separate production branch that lags a bit behind the more cutting edge main branch. Sometimes you want to move some, but not all commits from main to production. This can be done with a git cherry-pick
.
However, this ma...
Configuring Git with .gitconfig
Basic configuration
Please keep this config simple. It should be a starting point for new developers learning Git.
[user]
name = Your Name
email = your.name@domain.com
[branch]
sort = -committerdate
[color]
ui = auto
[color "bra...
Git: How to check out branches that exist on multiple remotes
So you're using multiple remotes that offer the same branch?
$ git branch -a | grep my-branch
remotes/something/my-branch
remotes/origin/my-branch
And when trying to check out that remote branch, it fails for you with an error li...