
I would expect this to set the upstream of the current. This configuration will tell git to show the relationship between the two branches in git status and git branch -v.
Otherwise, we’ll use the name of the current branch: local upstreamĪll that remains is to run the git command. This counter-intuitively creates a LOCAL () branch named origin/foo which tracks the current branch. When creating a new branch, set up branch.If we’re passed a parameter, we’ll use that for the name of the upstream branch. We’ll set the result to a local variable called “current”: local currentĬurrent="$(git rev-parse -abbrev-ref HEAD)" I was going to name this function “gsu” but I have that aliased to git submodule update.įor this function, we must retrieve the name of the current branch. If you haven’t deciphered it yet, “gsut” stands for Git Set Upstream To.

Heres a scenario that would require you to configure an upstream branch. gsut to set the upstream tracking branch to the same name as the current branch In theory, local and remote branches in Git are completely separate items. Git set upstream is crucial in keeping the local repo in sync with a remote one.We’re going to create a zsh shell function that will allow you to type: What if I gave you a better way? Enter Shell Functions. So what do you do? You go to the mouse, swipe over the command to select it, copy it (if your terminal doesn’t do that automatically), paste it as a new command, fiddle with it a bit for accuracy, and press Enter. Git branch -set-upstream-to=origin/ master

If you wish to set tracking information for this branch you can do so with: If you havent deciphered it yet, gsut stands for Git Set Upstream.
Please specify which branch you want to rebase against. gsutYou’ve seen it many times: There is no tracking information for the current branch.
#Git set upstream local branch update#
Update : I just learned about the new git setting: toSetupRemote - I learned it from here, and so can you!
