Last active
December 4, 2022 06:18
-
-
Save Sushant/3174585 to your computer and use it in GitHub Desktop.
Git uncommon but useful 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
# Delete Remote branch: | |
$ git push origin :newfeature | |
# Show details of a specific commit: | |
$ git show 44f1f96e23ecb835e4442bf464861231b2d96d7e | |
# Merge specific files from another branch: | |
# You are in the branch you want to merge to | |
$ git checkout <branch_you_want_to_merge_from> <file_paths...> | |
# Git export | |
$ git archive HEAD | gzip > archive.tar.gz | |
# Git diff against a stash | |
$ git stash show -p stash@{0} | |
# Apply a stash | |
$ git stash apply stash@{1} | |
# Remove branches that have been deleted on remote repo | |
$ git remote prune origin | |
# Remove branches that have been merged with master | |
$ git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment