Fix git tracking issue in file movement
- Replace mv with git mv to preserve git file tracking - Remove unnecessary git add step since git mv automatically stages changes - Fix issue where moved files appeared as deleted in git status - Ensure proper git history preservation when files are reorganized - Files will now show as moved/renamed instead of deleted/added in git log
This commit is contained in:
@@ -40,7 +40,8 @@ jobs:
|
||||
# Move file if it's not already in the correct location
|
||||
if [ "$src" != "$dest" ] && [ -f "$src" ]; then
|
||||
echo "Moving: $src -> $dest"
|
||||
mv "$src" "$dest"
|
||||
# Use git mv to preserve git tracking
|
||||
git mv "$src" "$dest"
|
||||
return 0 # Success - file was moved
|
||||
fi
|
||||
return 1 # No file moved
|
||||
@@ -85,7 +86,7 @@ jobs:
|
||||
run: |
|
||||
git config --local user.email "${{ vars.WORKER_EMAIL }}"
|
||||
git config --local user.name "${{ vars.WORKER_USERNAME }}"
|
||||
git add docs/datasheets/ docs/images/
|
||||
# git mv already stages the changes, so no need for git add
|
||||
git commit -m "Auto-sort: Move DS_ and IMG_ prefixed files to correct directories
|
||||
|
||||
- Moved datasheet files (DS_*) to docs/datasheets/
|
||||
|
||||
Reference in New Issue
Block a user