hmgill commited on
Commit
48106cb
·
verified ·
1 Parent(s): 12d7f20

Delete reset_git_lfs.sh

Browse files
Files changed (1) hide show
  1. reset_git_lfs.sh +0 -144
reset_git_lfs.sh DELETED
@@ -1,144 +0,0 @@
1
- #!/bin/bash
2
- # Reset Git History and Setup Git LFS Properly
3
- # Use this when you need to start fresh with Git LFS tracking
4
-
5
- set -e # Exit on any error
6
-
7
- echo "================================================"
8
- echo "Git History Reset and LFS Setup"
9
- echo "================================================"
10
- echo ""
11
- echo "⚠️ WARNING: This will delete all git history!"
12
- echo "Make sure you have a backup of your files."
13
- echo ""
14
- read -p "Continue? (yes/no): " confirm
15
-
16
- if [ "$confirm" != "yes" ]; then
17
- echo "Aborted."
18
- exit 1
19
- fi
20
-
21
- echo ""
22
- echo "📂 Current directory: $(pwd)"
23
- echo ""
24
-
25
- # Step 1: Remove .git directory
26
- echo "1️⃣ Removing old git history..."
27
- if [ -d .git ]; then
28
- rm -rf .git
29
- echo " ✅ Removed .git directory"
30
- else
31
- echo " ℹ️ No .git directory found"
32
- fi
33
-
34
- # Step 2: Initialize fresh git repo
35
- echo ""
36
- echo "2️⃣ Initializing fresh git repository..."
37
- git init
38
- echo " ✅ Git repository initialized"
39
-
40
- # Step 3: Setup Git LFS
41
- echo ""
42
- echo "3️⃣ Setting up Git LFS..."
43
- git lfs install
44
- echo " ✅ Git LFS installed"
45
-
46
- # Step 4: Track large files with LFS
47
- echo ""
48
- echo "4️⃣ Configuring Git LFS tracking..."
49
-
50
- # Track model checkpoints
51
- git lfs track "*.ckpt"
52
- git lfs track "*.pth"
53
- git lfs track "*.bin"
54
- git lfs track "*.h5"
55
- git lfs track "*.pkl"
56
- git lfs track "*.pickle"
57
-
58
- # Track images
59
- git lfs track "*.png"
60
- git lfs track "*.jpg"
61
- git lfs track "*.jpeg"
62
- git lfs track "*.gif"
63
- git lfs track "*.bmp"
64
- git lfs track "*.tiff"
65
-
66
- # Track compressed files
67
- git lfs track "*.zip"
68
- git lfs track "*.tar.gz"
69
- git lfs track "*.tar"
70
-
71
- echo " ✅ Git LFS tracking configured"
72
-
73
- # Step 5: Show what's being tracked
74
- echo ""
75
- echo "📋 Files tracked by Git LFS:"
76
- cat .gitattributes
77
-
78
- # Step 6: Add all files
79
- echo ""
80
- echo "5️⃣ Adding all files to git..."
81
- git add .gitattributes
82
- git add .
83
-
84
- echo " ✅ Files added"
85
-
86
- # Step 7: Show status
87
- echo ""
88
- echo "📊 Git status:"
89
- git status
90
-
91
- # Step 8: Create initial commit
92
- echo ""
93
- read -p "Create initial commit? (yes/no): " commit_confirm
94
-
95
- if [ "$commit_confirm" = "yes" ]; then
96
- echo ""
97
- echo "6️⃣ Creating initial commit..."
98
- git commit -m "Initial commit with Git LFS"
99
- echo " ✅ Initial commit created"
100
- else
101
- echo " ⏭️ Skipped commit"
102
- fi
103
-
104
- # Step 9: Add remote (if needed)
105
- echo ""
106
- read -p "Add remote repository? (yes/no): " remote_confirm
107
-
108
- if [ "$remote_confirm" = "yes" ]; then
109
- echo ""
110
- read -p "Enter remote URL (e.g., https://huggingface.co/user/repo): " remote_url
111
-
112
- git remote add origin "$remote_url"
113
- echo " ✅ Remote added: $remote_url"
114
-
115
- echo ""
116
- read -p "Push to remote? (yes/no): " push_confirm
117
-
118
- if [ "$push_confirm" = "yes" ]; then
119
- echo ""
120
- echo "🚀 Pushing to remote..."
121
- echo " (You may be prompted for credentials)"
122
- git push -u origin main --force
123
- echo " ✅ Pushed to remote"
124
- fi
125
- fi
126
-
127
- echo ""
128
- echo "================================================"
129
- echo "✅ Git reset complete!"
130
- echo "================================================"
131
- echo ""
132
- echo "📝 Summary:"
133
- echo " - Old git history removed"
134
- echo " - Fresh repository initialized"
135
- echo " - Git LFS configured"
136
- echo " - Large files tracked with LFS"
137
- echo ""
138
- echo "🔍 Verify LFS files:"
139
- echo " git lfs ls-files"
140
- echo ""
141
- echo "📤 If you haven't pushed yet:"
142
- echo " git remote add origin <your-repo-url>"
143
- echo " git push -u origin main --force"
144
- echo ""