Roots Discourse

Cloning git repository and pulling changes from sage updates

sage8

#1

I’m new to git and it’s confusing as hell but I’m getting there, so please correct me if I’m completely wrong about any of this.

Basically I’m wondering if I can clone Sage to a new repository of my own, and then merge any updates to sage with my existing repository.

For example lets say I clone Sage 8.5.2, and call it MyTheme. I track my changes to MyTheme in the usual way with git. Then I want to update MyTheme with any changes made to sage in 8.5.3 how could I get those changes from GitHub? Is this even possible? It would provide an easy way to stay up-to-date during theme development.


#2

I don’t know if there’s an official word, but I generally don’t bother to update sage once I’ve started a project. It’s a framework to build on, so once I get particularly deep in there’s not much point to pulling in new code.

The exception is when new changes fix a problem I’m having, in which case I’ll just manually apply the pull request that fixes that issue (if I can) or merge an updated version of sage into my project. Merging a new update into an existing project is always going to be a bit of a pain, though, so I usually try and avoid it.


#3

Yeah, generally I had thought that would be most peoples response! It makes sense. But lets say the exception is the case, how would you go about merging an updated version of sage into your project?


#4

If you’re merging a super simple bug fix from upstream Sage, you could do it by hand, of course. For approaches that better use the power of git you could see this note about cherry picking Sage commits:


#5

Echoing what @alwaysblank said above: unless there’s a specific new feature or bugfix that you desperately need to bring in, your dev life will be much easier just continuing to develop on your fork of Sage. Cherry-pick anything that becomes essential, otherwise don’t worry about it.


#6
git remote add roots git@github.com:roots/sage.git

git merge --squash roots/branch-name --allow-unrelated-histories

See if this does what you want