Questions and answers with git

Peter Rogers (peter.rogers@gmail.com)

https://github.com/parogers

April 2019

Problem: I find git complicated

Solution: ask the right questions

My process:

Q: What's up with my branch?

The command:

git status

I created a shortcut (in bash) because I do this all the time:

> alias st="git status"

The shortcut:

> st

Q: Where does my branch fit in?

The command:

> git log --decorate --graph --oneline

The command:

> lg

Q: What's the story so far?

The command:

> git log --decorate --merges --oneline

The command:

> lgm

Q: What does rebasing do?

The command:

> git merge-base first-branch second-branch

I don't do this often enough to warrant a shortcut.

Q: What are others working on?

The command:

> git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:relative) -- %(refname:short)'

The command:

> bl

Q: Anything new?

The command:

> git for-each-ref --sort=-committerdate refs/remotes/ --format='%(committerdate:relative) -- %(refname:short)'

The command:

> blr

Thanks!

Today we talked about how I answer some simple questions:

← →

/