From 69440910229b79b5ad92a5c09d91d794cb113fa9 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 15 Oct 2024 19:36:47 +0200 Subject: [PATCH] chore(git): reset fork to upstream state --- knowledge base/git.md | 9 +++++++++ snippets/git.sh | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/knowledge base/git.md b/knowledge base/git.md index 82231a3..bfdebca 100644 --- a/knowledge base/git.md +++ b/knowledge base/git.md @@ -357,6 +357,13 @@ git show :/cool # Skip commit hooks. # Most useful with a broken `pre-commit` or `lefthook` executable or config. git commit --no-verify … + +# Reset fork to upstream's state +git remote add 'upstream' '/url/to/original/repo' +git fetch 'upstream' +git checkout 'master' +git reset --hard 'upstream/master' +git push 'origin' 'master' --force ``` ## Authentication @@ -1028,6 +1035,7 @@ git -c http.sslVerify=false … - [Dress up your git diffs with word-level highlights] - [Git global config for specific repositories?] - [cheat.sh] +- [Clean up a fork and restart it from the upstream]