Skip to content

Commit fc283f2

Browse files
committed
Section: Creating a Topical Branch
1 parent 513674a commit fc283f2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Readme.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ There are 2 main work flows when dealing with pull requests:
1616
2. Pull Request from a branch within a repository
1717

1818
Here we are going to focus on 2.
19+
20+
### Creating a Topical Branch
21+
22+
First, we will need to create a branch from the latest commit on master. Make sure your repository is up to date first using
23+
24+
```bash
25+
git pull origin master
26+
```
27+
28+
*Note:* `git pull` does a `git fetch` followed by a `git merge` to update the local repo with the remote repo. For a more detailed explanation, see [this stackoverflow post](http://stackoverflow.com/questions/292357/whats-the-difference-between-git-pull-and-git-fetch).
29+
30+
To create a branch, use `git checkout -b <new-branch-name> [<base-branch-name>]`, where `base-branch-name` is optional and defaults to `master`. I'm going to create a new branch called `pull-request-demo` from the `master` branch and push it to github.
31+
32+
```bash
33+
git checkout -b pull-request-demo
34+
```
35+

0 commit comments

Comments
 (0)