Skip to content

Commit

Permalink
Fix rule "i-want-to-create-a-new-remote-branch-from-current-local-one" (
Browse files Browse the repository at this point in the history
k88hudson#208)

* Add missing HEAD argument in 2 Git commands

These commands had been inserted in k88hudson#148 and (over)simplified in k88hudson#163.

The issue is that `git push <remote>` and `git push -u <remote>` will
typically raise the error below (unlike `git push <remote> HEAD`):

--8<---------------cut here---------------start------------->8---
fatal: The current branch new-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new-branch
--8<---------------cut here---------------end--------------->8---

* Add doc URL & Avoid triple backquotes
  • Loading branch information
erikmd authored and RichardLitt committed Feb 20, 2018
1 parent d8c55ae commit 4d42bb9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,13 @@ This will give you a local copy of the branch `daves`, and any update that has b
### I want to create a new remote branch from current local one

```sh
$ git push <remote>
$ git push <remote> HEAD
```

If you would also like to set that remote branch as upstream for the current one, use the following instead:

```sh
$ git push -u <remote>
$ git push -u <remote> HEAD
```

With the `upstream` mode and the `simple` (default in Git 2.0) mode of the `push.default` config, the following command will push the current branch with regards to the remote branch that has been registered previously with `-u`:
Expand All @@ -794,7 +794,7 @@ With the `upstream` mode and the `simple` (default in Git 2.0) mode of the `push
$ git push
```

The behavior of the other modes of ```git push``` is described in the doc of push.default.
The behavior of the other modes of `git push` is described in the [doc of `push.default`](https://git-scm.com/docs/git-config#git-config-pushdefault).

### I want to set a remote branch as the upstream for a local branch

Expand Down

0 comments on commit 4d42bb9

Please sign in to comment.