Git command to checkout any branch and overwrite local changes
You could follow a solution similar to “How do I force “git pull” to overwrite local files?”: git fetch –all git reset –hard origin/abranch git checkout abranch That would involve only one fetch. With Git 2.23+, git checkout is replaced here with git switch (presented here) (still experimental). git switch -f $branch (with -f being … Read more