Random snippets of useful (for me) pieces of information, quick reminders, ideas...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.3 KiB



  • us: changes on the branch I am rebasing onto (eg. the master), usually "the good official one"
  • they: changes of the branch I am rebasing (eg. feature branch)

Search keyword

git log -S <keyword>

Fetch and remove deleted branches

git fetch --prune


git worktree add <path> <branch>
git worktree remove [--force] <path>

Use force if you have initialized submodules in the worktree.

Rebase multiple divergent branches

git rebase --interactive --onto <newparent> <oldparent>

What commit added a certain file?

git log --diff-filter=A -- path/file

Changes of a certain file

git diff <branch> -- path/file

Git pull strategy

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.