Skip to content

Commit

Permalink
Add compare branches example (#105)
Browse files Browse the repository at this point in the history
Add an example of comparing branches (from a common ancestor), using `git merge-base`
  • Loading branch information
mcherfaouiSFDC authored Feb 22, 2021
1 parent 5887183 commit ef2388a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,26 @@ And voilà! 🥳

SGD works with any git sha pointer: commit sha, branch, tag, git expression (HEAD, etc.).

Here are 2 examples showing how you can compare the content of different branches:
Here are 3 examples showing how you can compare the content of different branches:

**1) Comparing commits in different branches**
(for example, if you have commit `fbc3ade6` in branch `develop` and commit `61f235b1` in branch `master`)
**1) Comparing between commits in different branches**
For example, if you have commit `fbc3ade6` in branch `develop` and commit `61f235b1` in branch `master`:
```
sfdx sgd:source:delta --to fbc3ade6 --from 61f235b1 --output .
```

**2) Comparing branches**
**2) Comparing branches (all changes)**
Comparing all changes between the `develop` branch and the `master` branch:
```
sfdx sgd:source:delta --to develop --from master --output .
```

**3) Comparing branches (from a common ancestor)**
Comparing changes performed in the `develop` branch since its common ancestor with the `master` branch (i.e. ignoring the changes performed in the `master` branch after `develop` was created):
```
sfdx sgd:source:delta --to develop --from $(git merge-base develop master) --output .
```

### Advanced use-case: Generating a folder containing only the added/modified sources

Using a package.xml file to deploy a subset of the metadata is propably the simpliest approach to delta deployments. But there are some situations where you may want to have the actual source files related to all the components that have been changed recently.
Expand Down

0 comments on commit ef2388a

Please sign in to comment.