I have a git log command that allows me to see local commits that haven’t yet been pushed to the remote repository. It looks like this:
ahead = log origin/master..HEAD --graph --pretty=format:'%Cred%h%Creset %d %s %Cgreen(%cr)%Creset %Cblue[%an]%Creset' --abbrev-commit --date=relative
This works fine as long as you are on the master branch. What I would like is a variable that I could put in the command where master is now, so that the git ahead alias would run against that branch. Something like the zsh $(git_prompt_info) variable, but that can be used in a gitconfig file as part of an alias definition.
You are looking for
@{u}:So your alias should look like this:
But I would recommend changing it to this:
This will show both commits in the remote that are missing locally as well as local comits that are missing in the remote.