## Picking a single commit

`git cherry-pick` applies the changes introduced by an existing commit and creates a new commit on the current branch with the same changes. Use [`git log`](/git/viewing-previous-commits) to find the commit hash you need.

```
$ git cherry-pick <commit-hash>
```

The commit hash can be abbreviated to the first 7 or more characters.

## Picking a range of commits

The range is exclusive of the first hash and inclusive of the second.

```
$ git cherry-pick <hash1>..<hash2>
```

To include the first commit in the range, use three dots:

```
$ git cherry-pick <hash1>^..<hash2>
```

## Staging without committing

The `-n` (or `--no-commit`) flag applies the changes to the working directory and staging area but does not create a new commit. Useful when combining changes from multiple commits into one.

```
$ git cherry-pick -n <commit-hash>
```

After staging any additional changes, commit them all together:

```
$ git commit -m "Your combined commit message"
```

## Handling conflicts

### After resolving, continue the cherry-pick

```
$ git add <resolved-file>
$ git cherry-pick --continue
```

### Abort and undo the cherry-pick

```
$ git cherry-pick --abort
```

If you need to integrate an entire branch rather than individual commits, consider using [`git merge`](/git/commands/git-merge) or [`git rebase`](/git/commands/git-rebase) instead.

Once your code is ready, [DeployHQ](https://www.deployhq.com) can deploy it to your servers automatically from any Git repository.