Last active
September 18, 2021 10:34
-
-
Save punkrocker178/e09315d153ae572bf2eab9abdb2dceee to your computer and use it in GitHub Desktop.
Git commands
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
# Add remote | |
git remote add origin https://github.com/user/repo.git | |
# Save git credential | |
git config --global credential.helper store | |
# Enable this to separate git credentials for different repos | |
git config --global credential.github.com.useHttpPath true | |
# Delete branch local (multiple delete): | |
git branch -d $(git branch | grep -E ‘<branch-name>’) | |
# Delete branch remote: | |
git push -d origin <branch_name> | |
# Delete multiple branch using regex, grep is used for filter output with regex, sed then use that oupt to edit(omit “origin/”) | |
git push -d origin $(git branch -r | grep -E '<regex>' | sed -e 's/origin\///') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment