forked from facebookresearch/sapiens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_script.sh
executable file
·52 lines (42 loc) · 1.34 KB
/
git_script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
if [ $# -eq 0 ]; then
echo "No commit message provided. Aborting!"
exit 1
fi
# Create .gitignore if it does not exist
if [ ! -f .gitignore ]; then
touch .gitignore
fi
# Ignore large files. Note: It appends to .gitignore.
# The loop handles file paths with spaces correctly.
find . -type f -size +100M | sed 's|^\./||' | while IFS= read -r file; do
grep -qxF "$file" .gitignore || echo "$file" >> .gitignore
done
# Function to add a line to .gitignore if not present
add_to_gitignore() {
grep -qxF "$1" .gitignore || echo "$1" >> .gitignore
}
# Example of how to include a subdirectory using '!'
# The following line would include the 'list' subdirectory if it existed inside 'mmhuman3d/data'
# add_to_gitignore "!mmhuman3d/data/list"
# Use the function to add lines
add_to_gitignore "pose/data"
add_to_gitignore "pose/Outputs"
add_to_gitignore "pose/checkpoints"
add_to_gitignore "pretrain/data"
add_to_gitignore "pretrain/Outputs"
add_to_gitignore "pretrain/checkpoints"
add_to_gitignore "seg/data"
add_to_gitignore "seg/Outputs"
add_to_gitignore "seg/checkpoints"
add_to_gitignore "__pycache__/"
add_to_gitignore "*.pyc"
add_to_gitignore "*.ipynb_checkpoints"
add_to_gitignore "*.so"
add_to_gitignore "*.DS_Store"
add_to_gitignore "*._*"
add_to_gitignore "*.egg"
# Push using the git command
git add -A
git commit -m "$1"
git push