DEV Community

Discussion on: Git aliases for increased productivity

Collapse
claudiofreitas profile image
Claudio Freitas

This one is saving me a lot of headache lately.

git config --global alias.set-upstream "!git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`"
Enter fullscreen mode Exit fullscreen mode

Then everytime you receive the message

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> branch-name
Enter fullscreen mode Exit fullscreen mode

just run

git set-upstream
Enter fullscreen mode Exit fullscreen mode

It is util when your local branch names are the same as in your remote.

Collapse
michi profile image
Michael Z Author • Edited

I don't recall running into this after having set the push.default option to current stackoverflow.com/a/948397

Only thing I have to do is add the -u flag to the push command once to set the upstream. (git push -u)