git checkout -b <new branch name> <some other exisiting branch>
```
#### Tracking Branches
Lets say you are working on a branch named `dev` which you fetched from the remote named `origin`. Now you want to work on this branch for a quite a long time and want the `git push` and `git pull` using the `dev` branch of `origin` by default. So that you won't have to type `git push origin dev` or `git pull origin dev` every time you want to update or pull the updates to and from the remote branch.
First, you need to tell Git which branch to track:
```c
# suppose you are on the dev branch on you local machine, and there is already a dev branch in the remote repo
gitbranch--set-upstream-toorigin/remote
```
This only works when there is already a `dev` branch in the remote repo. If you want to create a new branch in the remote repo, and track it automatically, then you can use the following command:
```
# this will create a dev branch in the remote and track it using the current branch locally
git push --set-upstream origin dev
# or, same as above
git push -u origin dev
```
#### Merging Branches
Merging in Git is the way to putting forked history back together again. The `git merge` command lets you integrate branches created by `git branch` into a single branch.