Last active
July 1, 2022 14:46
-
-
Save arelra/d10e9f5a37c4800c49e8cb2cb3f266ce to your computer and use it in GitHub Desktop.
Git stuff
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
# list all remotes | |
git remote -v | |
# delete a remote | |
git remote remove repoalias | |
# push a repo to another repo | |
git remote add newrepo git@... | |
git push newrepo main | |
# create patches for all commits including initial commit | |
git format_patch sha1..sha2 --root | |
# apply patches | |
git am *.patch | |
# log pretty print oneline | |
git log --pretty=oneline | |
# count commits given a date range | |
git log --pretty=oneline --since='Jan 1 2021' --until='Dec 31 2021' | wc -l | |
# git log search follow renames, detect with M percentage change. default is M5 or M50% | |
git log --pretty=oneline --follow -M path/to/file.ts | |
# git log search follow renames, detect with 90% percentage change | |
git log --pretty=oneline --follow -M9 path/to/file.ts | |
# set upstream | |
git push -u origin branchname | |
git branch --set-upstream-to origin/branchname | |
git branch -u origin/branchname | |
# push from local to a different remote | |
git push -u origin local_branch:remote_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment