GitHubTricks
How to clone a Github Gist via SSH protocol?
[+]git clone git@github.com:5834862.git
https://
to git@
and /****.git
to :****.git
Be sure to include empty dirs
[+]git add .
Be sure to create empty files into empty dirs by
find . -type d -empty -not -path "./.git/*" -exec touch {}/.gitkeep \;
Submodules
[+]Suppose that in your new repo, called `NewRepo` , for which you already have a cloned local copy. Suppose that you want to use an external repo called `rock`. Then in your cloned local copy you can use
git submodule add https://github.com/<user>/rock rock git commit -am 'New submodel rock added' git push origin master
If you look at your repo in GitHub you now should have an special folder with the assigned submodule name, which is just a link to the official existing repo. Note however that the submodule have a hash for the specific cloned branch.
The next time we clone the new repo you must use the proper option to clone also the submodules:
git clone --recursive https://github.com/MyUser/NewRepo
Or if you just forgot to use the `--recursive option`, just use in your cloned local copy
git submodule update --init --recursive
Now, suppose that the external repo is updated and you need your new repo to point out to the last version. This can be accomplished with
git pull --recurse-submodules git submodule update --remote --recursive git commit -am 'Updated Submodules tags' git push origin master
Further info in https://github.com/blog/2104-working-with-submodules
Non Advanced Search or Natural Search
Advanced Search or Boolean Search
Default search behavior
By default, all search terms are optional. It behaves like an OR logic. Objects that contain the more terms are rated higher in the results and will appear first in their type. For example, wiki forum will find:
- objects that include both terms
- objects that include the term wiki
- objects that include the term forum
Requiring terms
Add a plus sign ( + ) before a term to indicate that the term must appear in results. Example: +wiki forum will find objects containing at least wiki. Objects with both terms and many occurences of the terms will appear first.
Excluding terms
Add a minus sign ( - ) before a term to indicate that the term must not appear in the results. To reduce a term's value without completely excluding it, use a tilde. Example: -wiki forum will find objects that do not contain wiki but contain forum
Grouping terms
Use parenthesis ( ) to group terms into subexpressions. Example: +wiki +(forum blog) will find objects that contain wiki and forum or that contain wiki and blog in any order.
Finding phrases
Use double quotes ( " " ) around a phrase to find terms in the exact order, exactly as typed. Example: "Alex Bell" will not find Bell Alex or Alex G. Bell.
Using wildcards
Add an asterisk ( * ) after a term to find objects that include the root word. For example, run* will find:
- objects that include the term run
- objects that include the term runner
- objects that include the term running
Reducing a term's value
Add a tilde ( ~ ) before a term to reduce its value indicate to the ranking of the results. Objects that contain the term will appear lower than other objects (unlike the minus sign which will completely exclude a term). Example: +wiki ~forum will rate an object with only wiki higher that an object with wiki and forum.
Changing relevance value
Add a less than ( < ) or greater than ( > ) sign before a term to change the term's contribution to the overall relevance value assigned to a object. Example: +wiki +(>forum < blog) will find objects that contain wiki and forum or wiki and blog in any order. wiki forum will be rated higher.