vangorra / git_split Goto Github PK
View Code? Open in Web Editor NEWTurn git directories into their very own repositories in their own location. No subtree funny business.
License: MIT License
Turn git directories into their very own repositories in their own location. No subtree funny business.
License: MIT License
Great script, but it doesn't maintain the directory structure in the new repo. All files in the target subdirectory end up in the root of the new repo.
I had to checkout another branch in the target directory, otherwise I got:
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
So the commands which made it somehow work are
> mkdir ProjectARepo
> git init ProjectARepo
> cd ProjectARepo
> git checkout -b foo
> cd ..
# copy over the master branch
> ./git_split myrepo master ProjectA ProjectARepo
Hey there, thanks for your contribution.
I noticed the use of mktemp -d
on your script, which works perfectly on linux (and makes a lot of sense). However, when trying it on a OS X computer, the command needs to change to something like mktemp -dt "temp"
where the "temp" can be whatever you want. At least that was my case. Here's how I solved it.
Unfortunately, by doing so, you're killing the functionality for linux computers. If you want a command that works well on both operating systems, I'd recommend changing it to something like:
mktemp -dt "temp.XXXXXX"
Just a suggestion, I don't think it qualifies as an "issue", since most people could find the answer without much hassle.
The link to the GitHub Help article changed:
https://help.github.com/articles/splitting-a-subfolder-out-into-a-new-repository/
Output:
$ ./git_split.sh https://github.com/LogoFX/LogoFX.git master LogoFX.Client.Bootstrapping.Platform logofx-client-bootstrapping
Cloning into '/tmp/git_split.3a5XRZ/repo_base'...
remote: Counting objects: 5819, done.
remote: Compressing objects: 100% (91/91), done.
remote: Total 5819 (delta 52), reused 0 (delta 0), pack-reused 5726
Receiving objects: 100% (5819/5819), 1.42 MiB | 280.00 KiB/s, done.
Resolving deltas: 100% (4552/4552), done.
Checking connectivity... done.
Checking out files: 100% (638/638), done.
/tmp/git_split.3a5XRZ/repo_base/LogoFX.Client.Bootstrapping.Platform doesn't exist or is not a directory.
Steps to reproduce:
This looks intentional but I cant fathom why
I have git_split.sh in $HOME/bin
repos in /myrepos
cd /myrepos
git init target
git_split relative/path/in/source target
Errors because it cant find $HOME/bin/target
/home/dlee/bin/git_split.sh: line 28: cd: /home/dlee/bin/target: No such file or directory
Hi! I'm using your handy git-split script to break directories out of my repo and create new repos out of them. I'm very happy that you built this because in theory, this should make my life very easy.
Unfortunately, after the split, there are no files in the new repository from the old one. Here's what happens:
> ./git-split.sh clean_repo trunk/wwwroot ~/new_repo
Cloning into '/tmp/tmp.eKwnObj7Yv/repo_base'...
done.
Checking out files: 100% (185470/185470), done.
Creating Repo from clean_repo trunk/wwwroot for /home/user/new_repo
Initialized empty shared Git repository in /home/user/new_repo/
Rewrite 1c8d0412ceafde85b9e4b5cb5bec849aab1e8703 (19572/19572)
Ref 'refs/heads/master' was rewritten
Counting objects: 150013, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (66636/66636), done.
Writing objects: 100% (150013/150013), 977.74 MiB | 13.93 MiB/s, done.
Total 150013 (delta 98258), reused 113003 (delta 78597)
To /home/user/new_repo
* [new branch] master -> master
It looks great, except when I cd
into new_repo, this is all I see:
branches config description HEAD hooks info objects refs
Where did the files and directories from clean_repo/trunk/wwwroot end up? Is there anything I can do to make this work better?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.