Last active
October 18, 2022 09:40
-
-
Save robCrawford/d68bc4188bd1b3ad502c6739519b9dba to your computer and use it in GitHub Desktop.
Open modified and new files in working directory using VSCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# Opens modified and new files in working directory using VSCode | |
wip() { | |
cd $(git rev-parse --show-toplevel) && | |
code $(git diff $1 $2 --diff-filter=d --name-only) $(git status -s | grep '??' | grep -v '/$' | cut -c 4-) && | |
cd -; | |
} | |
# Opens modified and new files in the previous commit using VSCode | |
# Can provide a hash for changes in that commit e.g. `wiprev 982ab5a` | |
wiprev() { | |
commit="${1:-head}" | |
wip "$commit^" "$commit" | |
} | |
# Opens modified and new files in the current branch using VSCode | |
wipbr() { | |
cd $(git rev-parse --show-toplevel) && | |
code $(git diff master...$1 --name-only --diff-filter=d) $(git status -s | grep '??' | grep -v '/$' | cut -c 4-) && | |
cd -; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment