Sfisioza February 2016
Push all git comits as one to empty bare repo
I have two bare repositories.
repo1 - with all the history
repo2 - new, empty one
I want to push all the files from
repo2, but without the whole history, just the the state from the last commit.
I don't want to touch the history of the
repo1 (it's best to assume it's read only). In the new repo I don't want to have any history (including reflogs), so shashing after the push is not an option.
Is this ever possible without creating new, temporary repository?
How can I achieve this?
David Deutsch February 2016
Do the following:
git checkout --orphan temp_branch
git commit -m "initial commit"
git push repo2 temp_branch:master
This will create a temp_branch locally with just a single commit with the current snapshot, and push it to a branch called "master" on repo2.
hagello February 2016
Assuming that you want to clone the head of
masterand assuming that you do not insist on a
# in repo2
# git fetch --depth 1 path_to_repo1 master:master
Asked in February 2016
Viewed 2,697 times
Answered 2 times
Leave an answer
Quote of the day: live life