Sfdx-git-delta: Change git diff command

Created on 18 Feb 2021  路  3Comments  路  Source: scolladon/sfdx-git-delta

Is your proposal related to a problem?

When comparing two branch where the source branch was created from the target branch some commits before the diff of the branches provides two many results.

Describe the solution you'd like

I would suggest to enhance the git diff command.
currently you are using
git diff sourcebranch..targetbranch

You can enhance this if you want to "ignore" changes on the target branch that have be done after source branch was created from target branch by using the following command :
git diff --name-status $(git merge-base targetbranch sourcebranch) sourcebranch <path>

Describe alternatives you've considered

None

Additional context

None

enhancement

Most helpful comment

Hi @scolladon
thank you very much for your Feedback.
Supplementing the point in the documentation would be sufficient.

The point you show was something that I was not aware of and might help other to understand the usage.

Thanks

All 3 comments

Hi @struthe

That is effectively very smart!
It could be done directly depending on the shell syntax in use
$ sfdx sgd:source:delta -r . -f $(git merge-base target source) -t target -d

Or in two times :
$ ancestor=$(git merge-base target source) $ sfdx sgd:source:delta -r . -f ancestor -t target -d

Currently the plugin allows to use any git sha pointer (tag, sha, branch) so all the power is in the hand of the end user and it gives a lot of flexibility.

I wonder if we should implement it directly in the cli or if we should document an example to use this git behavior.
My opinion is we should just document this usage in the readme
@mehdisfdc any thought here ?

Hi @scolladon
thank you very much for your Feedback.
Supplementing the point in the documentation would be sufficient.

The point you show was something that I was not aware of and might help other to understand the usage.

Thanks

Thank you @struthe for bringing this to our attention!
I agree that an additional to the documentation would be useful!
@struthe @scolladon I've opened https://github.com/scolladon/sfdx-git-delta/pull/105 to update the readme, it that enough in your opinion? Feel free to suggest any change to this example if you feel that more explanation are needed.

Was this page helpful?
0 / 5 - 0 ratings