github-stats icon indicating copy to clipboard operation
github-stats copied to clipboard

Add instructions on how to update copy of template

Open erikw opened this issue 3 years ago • 1 comments

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 [email protected]: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" = "[email protected]: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

erikw avatar Feb 17 '22 08:02 erikw

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.

jstrieb avatar May 08 '22 01:05 jstrieb