![]() Otherwise, weâll use the name of the current branch: local upstreamĪll that remains is to run the git command. The easiest way to set the upstream branch is to use the git push command with the -u option for upstream 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)" It is possible to set the branch on the remote each of your local remotes corresponds to. 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. ![]() gsut to set the upstream tracking branch to the branch named name.gsut to set the upstream tracking branch to the same name as the current branch.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. When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch..remote and branch..merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch.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: Please specify which branch you want to rebase against. Youâve seen it many times: There is no tracking information for the current branch. Will fail unless you manually run git fetch origin-push. Now when the background process runs git fetch origin the references on origin-push wonât be updated, and thus commands like: git push -force-with-lease origin-push. Update : I just learned about the new git setting: toSetupRemote - I learned it from here, and so can you! git remote add origin-push (git config ) git fetch origin-push.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |