github - Merge a git repository lacking commits history to a repository that preserved history -
i downloaded source code of c++ project instead of cloning git repository @ git://www.calatk.org/calatk.git
using source code (with no git history), created git repo, worked on code while, , pushed work/branches github @ https://github.com/agirault/calatk
i make pull request merge code original git repository on calatk.git.
i wondering how since don't have track previous commits in repository. repository on calatk.org should not have been updated since then, means last commit same first commit available on github.
assuming don't mind replacing published github repository 1 contains original project's history†, here try:
add upstream repository second remote:
git remote add upstream <clone-url>
fetch upstream:
git fetch upstream
this should generate new branch pointers including
upstream/master
.upstream/master
should not share history existing commits. is, you'll have 2 root commits: 1 upstream project , 1 fork.rebase work onto upstream commits (assuming have
master
worry about):git checkout master git rebase upstream/master
at point should have 1 root commit: 1 upstream project. hash old root commit, should no longer root commit, should match shown in upstream project (
3cee904
).you can use
git show 3cee904
make sure commit correct.force push new history github:
git push --force origin master
submit changes upstream repository according contribution guidelines.
since it's not on github or bitbucket it's not they'll able accept pull request (that's proprietary feature). should able request push access or use
git format-patch
, though. upstream maintainersfetch
public github repository.
†important note: if you've got collaborators on github project may not best option. modifying shared commits in git discouraged. i'm recommending since sounds github repository personal repository.
Comments
Post a Comment