Add git-cat-file-for-each-branch.sh and git-lfs-undo.sh in scripts/shell/job
This commit is contained in:
17
scripts/shell/job/git-cat-file-for-each-branch.sh
Executable file
17
scripts/shell/job/git-cat-file-for-each-branch.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
filename=$1
|
||||||
|
repo_dir=`pwd`
|
||||||
|
|
||||||
|
for branch in $(git for-each-ref --format='%(refname)' refs/remotes/origin); do
|
||||||
|
cmd_out=`git show $branch:$filename`
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
cmd_out="[$branch] O arquivo \"$filename\" não existe no branch"
|
||||||
|
else
|
||||||
|
echo "[$branch] Arquivo:"
|
||||||
|
echo "$cmd_out"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
done
|
||||||
34
scripts/shell/job/git-lfs-undo.sh
Executable file
34
scripts/shell/job/git-lfs-undo.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
repo_dir=`pwd`
|
||||||
|
cd $repo_dir
|
||||||
|
|
||||||
|
# method 1
|
||||||
|
# source: https://github.com/git-lfs/git-lfs/issues/3026
|
||||||
|
|
||||||
|
# lfs_files=`git lfs ls-files | awk -F' ' {'print $3'}`
|
||||||
|
|
||||||
|
# for f in ${lfs_files[@]}; do
|
||||||
|
# git rm --cached $f # "remove" the lfs file
|
||||||
|
# git add $f # add the "normal" file
|
||||||
|
# done
|
||||||
|
|
||||||
|
# gitattr_filename='.gitattributes'
|
||||||
|
# if [ -f "$gitattr_filename" ]; then
|
||||||
|
# rm --force $gitattr_filename
|
||||||
|
# git add $gitattr_filename
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# git commit -m "restore files from lfs"
|
||||||
|
|
||||||
|
# method 2
|
||||||
|
# source: https://stackoverflow.com/questions/35011366/move-git-lfs-tracked-files-under-regular-git/54119191#54119191
|
||||||
|
|
||||||
|
# git lfs untrack "*"
|
||||||
|
# git add --renormalize .
|
||||||
|
# git commit -m "Restore file contents that were previously in LFS"
|
||||||
|
|
||||||
|
# method 3
|
||||||
|
# source: https://gist.github.com/everttrollip/198ed9a09bba45d2663ccac99e662201?permalink_comment_id=3695821#gistcomment-3695821
|
||||||
|
|
||||||
|
git-lfs uninstall --local && echo " " > .gitattributes && git add --renormalize .
|
||||||
Reference in New Issue
Block a user