"git fetch jumpstart" not working after rebuild

Darren Smyth

I've had to rebuild my computer and now having cloned my app back onto my computer, I can't seem to use the following commands:

git fetch jumpstart
git merge jumpstart/master

Does anyone know how I can get this working again? I have very limited knowledge of git.

Thanks in advance
Chris Oliver
You'll have to tell us the errors, otherwise we don't know what's going wrong. 😜

If I had to guess, I'd bet that the jumpstart remote is missing. If so, then you'd just add it.

git remote add jumpstart [email protected]:gorails/jumpstart-pro.git
Darren Smyth
That might be helpful... sorry Chris Oliver  

I've added all the remotes I think I need (and uploaded SSH keys) but his is what I'm getting back:

heroku	https://git.heroku.com/newmaffsguru.git (fetch)
heroku	https://git.heroku.com/newmaffsguru.git (push)
jumpstart	[email protected]:gorails/jumpstart-pro.git (fetch)
jumpstart	[email protected]:gorails/jumpstart-pro.git (push)
origin	https://github.com/dazzaroonie/newmaffsguru.git (fetch)
origin	https://github.com/dazzaroonie/newmaffsguru.git (push)
Darrens-iMac:newmaffsguru dazzaroonie$ git fetch jumpstart
warning: no common commits
remote: Enumerating objects: 252, done.
remote: Counting objects: 100% (252/252), done.
remote: Compressing objects: 100% (168/168), done.
remote: Total 7410 (delta 113), reused 198 (delta 81), pack-reused 7158
Receiving objects: 100% (7410/7410), 1.84 MiB | 1.70 MiB/s, done.
Resolving deltas: 100% (4544/4544), done.
From gitlab.com:gorails/jumpstart-pro
 * [new branch]      master       -> jumpstart/master
 * [new branch]      multitenancy -> jumpstart/multitenancy
 * [new branch]      sca          -> jumpstart/sca
Darrens-iMac:newmaffsguru dazzaroonie$ git merge jumpstart/master
fatal: refusing to merge unrelated histories

What am I doing wrong??
Chris Oliver
Unrelated histories means that you've got a git repo that doesn't match the Jumpstart one.

You would want to make sure you cloned from the Jumpstart Pro repo and then renamed the remote. That way your copy of the repo would start with all the commits from ours, not a fresh repo.

I'm not sure how you can reconcile what you've got exactly without starting a new repo.
Darren Smyth
Thanks so much. This is going to be horrible!
But has to be done so I can have your latest updates etc.
I have same problem. (And I think the startup docs could be better. Like, maybe a 2 minute video. Or an extra 20 words with an overview of the startup procedure. Cause saying "3. Clone the Jumpstart Pro repository" is not the same say as saying "3. On your computer, clone the JSP Github repo" (the prior step was talking about setting up a repo on Github, so I thought I was to clone it there). Which somehow dropped all the commit history.

Anyway, damage done. 

Does anyone have any suggestion, how to merge into the current JSP git repo a hundred commits made to a custom MYAPP repo back that started on June 1 (equivalent to commit 6011f7c07)?

I'm guessing it's something like 

  1. Make a fresh copy of the JSP repo the right way (with all the JSP history)
  2. Drop all the "new" JSP changes since June 1 (in my case drop everything after commit 6011f7c07)
  3. Somehow re-apply all the changes made in MYAPP repo (which ought to be straighforward since the starting point is exactly the same code, although a different commit id (JSP 6011f7c07 = MYAPP 8fad64dc25)
  4. THEN follow the correct update procedure going forward, eg, merge the new JSP commits (that were dropped in step 2 in order to insert the MYAPP custom code)

Found good answer on Stackoverflow

If you know which JSP commit hash has the same code you started with, call it departure-point-hash

git clone server/some_template.git REDO    # make fresh new copy of JSP
git remote add mycommits ../path/to/MYAPP    # your current repo folder
git fetch mycommits
git checkout -b RESYNC departure-point-hash
git cherry-pick your-first-commit-hash..your-last-commit-hash

then, to make RESYNC a new master, with your code parented by the JSP commits as of at the time you started adding code:

make a new repo (github, whatever)

git branch -m master old-master
git branch -m resync master
git remote rename origin jumpstart
git remote add origin [email protected]:USER/NEWREPO.git

git push -u origin master

now NEWREPO on github has one branch, master, which is JSP as of departure-point-hash, then all your custom commits.

At THIS point, presumably, you can switch MYAPP over to use the NEWREPO, and proceed with development and/or merging newer commits from JSP.

You’re not receiving notifications from this thread.
© 2021 GoRails, LLC