A collection of Git snippets.
Last active
January 19, 2022 23:27
-
-
Save ethauvin/50eea318470f44d97d31453470ba8b80 to your computer and use it in GitHub Desktop.
git snippets
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
git update-index --chmod=+x *.sh *.bat |
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
git diff --cached <file> ... |
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
git ls -i --grep='<given-text>' |
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
git check-ignore * |
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
git whatchanged --since='2 weeks ago' | |
git show -2 | |
git log -2 |
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
#CREATE | |
git checkout -b newbranch | |
#MERGE | |
git ss | |
git cm "If necessary"; git pa | |
git checkout master | |
git ss | |
git cm "If necessary"; git pa | |
git checkout newbranch | |
# git merge --strategy=ours master | |
git merge -Xours master | |
git checkout master | |
git merge --no-ff newbranch | |
#LIST | |
git branch --merged | |
git branch -r --merged | |
#DELETE | |
git branch -d newbranch | |
git push all --delete newbranch |
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
git submodule foreach git pull |
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
git remote add upstream [email protected]:repo/repo.git | |
git fetch upstream | |
git checkout master | |
git merge upstream/master | |
# OR | |
git fup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment