Last active
February 11, 2021 02:26
-
-
Save tsathis/e29cc17c69d43f36619e452e2cf19a98 to your computer and use it in GitHub Desktop.
Favourite git commands.
This file contains hidden or 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
# update the origin | |
git remote set-url origin <new-remote> | |
# add another repo as a submodule | |
git submodule add <that-repo-url> <folder-name-for-submodule> | |
# clone with submodules | |
git clone --recursive <url> | |
# download All submodules | |
git submodule update --init --recursive | |
# make a subdirectory the repo | |
git filter-branch --subdirectory-filter <folder> -- --all | |
# fetch the latest changes from upstream in each submodule, merge them in, and check out the latest revision of the submodule | |
git submodule update --remote --merge | |
# Git create empty branch | |
git checkout --orphan <branchname> | |
# commit branch with empty commit and then push. | |
git commit -m <commit message> --allow-empty | |
git push origin <newbranch> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment