Show informations about remote branches:
git remote show originStop tracking deleted remote branches:
git remote prune origin --dry-runVerify origin and upstream setup:
git remote -vIf upstream is missing, setup:
git remote add upstream [email protected]:some-gatekeeper-maintainer/some-project.gitCollect changes of upstream repository:
git fetch upstreamCheckout main branch (master):
git checkout masterAnd continue usual workflow:
git pull upstream master || $ git merge upstream/master || $ git rebase upstream/masterLook to log for what you lost:
git reflogCreate new branch from what you found:
git checkout -b branch-name 70b3696To keep changes:
git reset HEADTo remove everything not commited permanently:
git reset --hard HEADTo reset changes to specific origin branch:
git fetch origin
git reset --hard origin/mastergit rm -r --cached .
git add .start interactive rebase as many commits backward as you need
git rebase -i HEAD~8and in message alter details of specific commits with command on next line after wanted commit pick
pick a37d264 PHPSPEC-1 Install
exec GIT_COMMITTER_DATE="Thu Jan 9 18:12:51 2020 +0000" git commit --amend --no-edit --date "Thu Jan 9 18:12:51 2020 +0000" --author="Peter Labos <[email protected]>"this change may require force push
Use last coorrect commit hash
git rebase -i f10cc70c049a297bbd05552c62d591ff96c41836 -x "git commit --amend --author 'Peter Labos <[email protected]>' -CHEAD"git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all