Ever wanted to grab a file from another branch in git
, but don’t want to checkout
to the target branch?
git-show
to the rescue.
export BRANCH="123-feature"
export INPUT="app/Http/Livewire/MyComponent.php"
export OUTPUT="MyComponent-123-feature.php"
git show $BRANCH:$FILE > $OUTPUT
Or git-diff
if you to do that:
git diff master:app/Http/Livewire/MyComponent.php \
feature:app/Http/Livewire/MyComponent.php