From da44b4d6c1f2367d848c250e33de72cec176b82b Mon Sep 17 00:00:00 2001 From: Siddharth Kannan Date: Mon, 18 Dec 2017 19:33:33 +0530 Subject: [PATCH] add the usage information for for git-branch --set-upstream-to (#176) * add application for git-branch --set-upstream-to * run doctoc - typo in one line for the TOC * put note in bash comment --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bc8f0cb..0280715 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ For clarity's sake all examples in this document use a customized bash prompt in - [I want to rename a branch](#i-want-to-rename-a-branch) - [I want to checkout to a remote branch that someone else is working on](#i-want-to-checkout-to-a-remote-branch-that-someone-else-is-working-on) - [I want to create a new remote branch from current local one](#i-want-to-create-a-new-remote-branch-from-current-local-one) + - [I want to set a remote branch as the upstream for a local branch](#i-want-to-set-a-remote-branch-as-the-upstream-for-a-local-branch) - [I want to set my HEAD to track the default remote branch](#i-want-to-set-my-head-to-track-the-default-remote-branch) - [Rebasing and Merging](#rebasing-and-merging) - [I want to undo rebase/merge](#i-want-to-undo-rebasemerge) @@ -78,7 +79,7 @@ For clarity's sake all examples in this document use a customized bash prompt in - [Apply a specific stash from list](#apply-a-specific-stash-from-list) - [Finding](#finding) - [I want to find a string in any commit](#i-want-to-find-a-string-in-any-commit) - - [I want to find by author/committer](#i-want-to-find-by-author-committer) + - [I want to find by author/committer](#i-want-to-find-by-authorcommitter) - [Miscellaneous Objects](#miscellaneous-objects) - [Clone all submodules](#clone-all-submodules) - [Remove a submodule](#remove-a-submodule) @@ -789,6 +790,23 @@ $ git push The behavior of the other modes of ```git push``` is described in the doc of push.default. + +### I want to set a remote branch as the upstream for a local branch + +You can set a remote branch as the upstream for the current local branch using: + +```sh +$ git branch --set-upstream-to [remotename]/[branch] +# or, using the shorthand: +$ git branch -u [remotename]/[branch] +``` + +To set the upstream remote branch for another local branch: + +```sh +$ git branch -u [remotename]/[branch] [local-branch] +``` + ### I want to set my HEAD to track the default remote branch