Adrian Andreias

Sep 24, 2014

Fresh git tips

1. Pull all branches without merge commit

git pull --ff-only --all

Pulls all branches from remote and merges only if there are fast-forward changes (that don't require a merge), otherwise fails. If any of the pulls fails you can handle it individually - you need to do that anyway.

Unfortunately git pull --all only does fetch --all and not the merging part on all branches, but only on current branch. There's git-up, but I don't like the automatic rebasing part. I'll keep searching for a solution that fits my needs. A little bash script in .gitconfig alises would be probably easiest.

2. Colored log tree view

git log --oneline --all --graph --decorate --color

3. And alias'em: `git pa` and `git lg`

Edit your user's git config \~/.gitconfig to create shortcuts for the two git commands:

[alias] lg = log --oneline --all --graph --decorate --color pa = pull --ff-only --all