Created
August 23, 2023 01:47
-
-
Save simonw/2a866f0c54462d6cdd95b97cd9c3ffa3 to your computer and use it in GitHub Desktop.
Script for reviewing every change to every file in a current Git repo and rejecting or keeping it
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
#!/bin/bash | |
# Get the list of changed files | |
files=$(git diff --name-only) | |
# Loop through each changed file | |
for file in $files; do | |
# Show the diff of the file | |
git diff $file | |
# Ask the user if they want to abandon the change | |
read -p "Abandon this change? y/n: " response | |
if [ "$response" = "y" ]; then | |
git checkout -- "$file" | |
echo "Changes in $file abandoned." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generated here https://chat.openai.com/share/3b0bab2f-0979-4b1d-9a1f-228d2738cec6
Prompt: