jstrieb / github-stats

Better GitHub statistics images for your profile, with stats from private repos too
GNU General Public License v3.0
2.96k stars 622 forks source link

Add instructions on how to update copy of template #66

Open erikw opened 2 years ago

erikw commented 2 years ago

It's nice to be up to date with the latest development in this main repo. For example I would like to get recently merged #65 in to my own copy of this repo.

As we create copies from this template repo instead of a fork, it's a bit more tricky to make the update. Are there already some instructions on how this can be done?

I did the following to update my own copy. There are for sure easier and better ways, but it did the job for me now.

In my copy of this repo at the master branch:

git remote add template git@github.com:jstrieb/github-stats.git
git fetch template

# Remove all bot commits to make my git history cleaner. Maybe not necessary?
# Reference: https://stackoverflow.com/a/8058619/265508
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --commit-filter '
    if [ "$GIT_AUTHOR_EMAIL" = "git@github.com:jstrieb/github-stats.git" ];
    then
            skip_commit "$@";
    else
            git commit-tree "$@";
    fi' HEAD

# Squash merge upstream changes in to 1 new commit.
git merge -Xtheirs --squash --allow-unrelated-histories template/master
git commit -m "Update from template"
git push -f origin master

I think we should add some instructions to the README on how people can keep their copies up to date with this repo :). If it involves a few shell commands, ideally they should be directly copy-and-pasteable for ultimate user convenience.

Relevant discussion on SO: https://stackoverflow.com/questions/56577184/github-pull-changes-from-a-template-repository#56577320

jstrieb commented 2 years ago

Hi @erikw! I definitely think this is a good idea! Especially since issue #19 for adding a dark theme has just been merged.

I'll do some research and testing locally, and may add some instructions to the README.