How to split a Git subdirectory into a new repo
ellie.wtf·75w
Preview
Report Post

First, install git-filter-repo. This is a python script, with no dependencies.

It’s easy to install. Just drop the script somewhere in your PATH. For me:

curl "https://raw.githubusercontent.com/newren/git-filter-repo/main/git-filter-repo" -o ~/.local/bin/git-filter-path

An important thing to note is that git-filter-repo will replace all other files in the repo with those in the subdir. You should operate on a fresh copy of your repo to avoid losing data.

Let’s imagine our repo looks like the following

🦄 ls -l
.rw-r--r-- ellie staff  0 B Mon Jul 29 14:13:39 2024 LICENSE
.rw-r--r-- ellie staff  0 B Mon Jul 29 14:13:34 2024 README.md
drwxr-xr-x ellie staff 64 B Mon Jul 29 14:13:35 2024 src/
drwxr-xr-x ellie staff ...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help