2

I'd like to fork a repo from github to bitbucket with clean history (I do not need and I want to save space). I found out that I can do it with git clone --depth 1 (shallow clone), but my question is if I'll be able to push updates from original repo to the new one?

Mixaz
  • 4,068
  • 1
  • 29
  • 55
  • According to this post : http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone ,with latest version of git (2.5+), it will work – edi9999 Oct 01 '15 at 15:19

1 Answers1

1

I finally decided to go with other solution without git clone --depth 1 - I was not able to push shallow clone to a new repo on github. I understood that I used a wrong approach.

I created a new branch with no commit history as suggested here: Make the current commit the only (initial) commit in a Git repository?:

git branch new_branch_name $(echo "commit message" | git commit-tree HEAD^{tree})

and then I pushed it to the new repo as described in this excellent guide: How to fork a github repository in bitbucket:

$ git checkout new_branch_name
$ git remote add bb git@bitbucket.org:jcaraballo/test.git
$ git push -u bb new_branch_name

So now I have only one branch in the new repo with clean history, and I can exchange updates between the repos via branch new_branch_name, merging changes there.

Community
  • 1
  • 1
Mixaz
  • 4,068
  • 1
  • 29
  • 55