So I'm trying to get my head around Git, and have the need (why I have this need I won't go into) to be able to take the files from one repo, via command line, and put them into a brand new repository WITHOUT taking all of the previous commit history with it.
What I'm trying to do at the moment is git init
to create a new repository, and then grab the files from my existing repo, either using clone or subtree (I've not got my head fully around this yet so may be barking up the wrong tree), and then add, commit, and then push these to my new repository.
git init
--- get the files from stock repo ---
git add .
git commit -m 'Initial commit'
git remote add origin <url of my new repo>
git push -u origin master
My repositories are all on Bitbucket, if that makes a difference,
Just for the record, you can clone a git repo within another one: Everything under your lib directory will be ignored by the enclosing Git repo, because said lib directory contains a . git . That means cloning the enclosing repo, and you will get an empty " lib/ " folder.
Each clone usually includes everything in a repository. That means when you clone, you get not only the files, but every revision of every file ever committed, plus the history of each commit.
You can clone the old repository like:
git clone [email protected]:username/repository.git
and then you delete the git directory:
rm -rf .git/
Now you create the new repository:
git init
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With