Last active
November 27, 2024 03:34
-
-
Save GalaxySH/a2f25edf3f1ab0ef36a36150d4eae061 to your computer and use it in GitHub Desktop.
My git secret sauce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use switch instead of branch to checkout a different branch, especially when it is remote | |
# Avoids creating a new branch that doesn't track origin, for instance | |
git switch | |
# Sync everything including remote branches from checked out repo to `neworigin` | |
git push neworigin --tags "refs/remotes/origin/*:refs/heads/*" | |
# or (untested) | |
git clone <repo> --mirror | |
git push <repo> --mirror | |
# Fix non-start of the windows gpg agent (that git uses) | |
gpg-connect-agent reloadagent /bye | |
# list remotes | |
git remote -vv | |
# for multiple remotes, push to origin by default | |
git push -u <remote_name> <local_branch_name>:<corresponding_remote_branch_name> | |
# or | |
git branch --set-upstream-to <remote-name>/<branch-name> | |
# or override all | |
git config remote.pushDefault origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment