Github code search on any branch - github

It is against general git workflow to make feature changes on a master branch. Sow= if I were to fork a repo my work ends up in .. feature branches..
How can I search those non-master branches on github?
Actually - even advanced search on Github seems to not find much of anything except for repository names and README files. It is not searching the codebase??
Here is an example of searching the yahoo user account for Process
: that should come up with dozens if not hundreds of hits. But we get .. four hits ..
So in general the github code search is a bit of a mystery . I really want to find certain code snippets .. either on master or another branch .. is there a way to do this??

There are tabs just below the header of the page - Repositories, Code, Commits, etc. If I click the Code tab I get 2k+ results.
There are some restrictions with searching code on GitHub, however, and branches other than master are not considered in the search. Also, only files smaller than 384 KB and repositories with less than 500,000 files are searchable. You can find more information related to searching code on GitHub here: https://help.github.com/articles/searching-code/

Related

Get an overview of my activities on GitHub

I would like to see an overview of my activities (e.g., commits in several branches, issues) on GitHub to see in which periods I was busy. I tried the following ways:
URL https://github.com/MYNAME/REPOSITORY/commits/?author=MYNAME, the problem is it returns only the master branch, while I have commits in other branches as well.
URL https://github.com/MYNAME?tab=overview&from=2022-02-01&to=2022-02-04, but the following graph does not seem to show commits in the branches other than master:
Does anyone have any ways to get a better overview? It is not necessarily by a direct URL, I could use GitHub Desktop, command lines, or a little bit of scripts as well.
Unfortunately, GitHub does not provide a way to see overall activity across branches in a repository, other than the default and the gh-pages branch - more information on https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile
As I haven't found anyone else resolving this, this leaves you with the option to write a piece of software that iterates through your repositories and checks the commits on all branches - introducing all kinds of challenges, such as overlapping commits and branches. Should be an interesting challenge though!

Why does searching in a forked repo on github show no result while searching in the original repo does?

I forked a github repo. I want to search for something in the codes. But searching in the original repo shows matches while searching in my forked repo shows nothing. Why?
Github doesn't allow searching in most forks. From Searching in Forks...
Forks are only indexed for code search when they have more stars than the parent repository. You will not be able to search the code in a fork that has less stars than its parent.
"Indexed" refers to creating a search index so Github can do fast searches without having to read all the code.
I assume this has to with conserving resources to both build and store the search index.

github - how to go to beginning of commit history OR scroll faster

Is there a way to either scroll faster through the commit history OR go to the very beginning?
I don’t see an option, not even on desktop site.
I’m trying to figure out why a certain branch was made but that info is not in the README section because the README is not customized per branch.
I don't think github has this built in but there are a couple of ways using URLs.
With some trial and error using page? gets you to the beginning of the history fast: https://github.com/micropython/micropython/commits/master?page=242
This is less trial and error because you can enter nearly exact values: you know the current latest commit's hash and github says there's about 8450 commits so this one gets you to the first page: https://github.com/micropython/micropython/commits/master?after=cada971113e6db0cf9e0751e95dbe9217dd707b5+8420
There used to be a tool for it but the site is dead now so only the code is left.
But anyway, I'm fairly sure you'd achieve your actual goal way (examining log searching for something) faster without github, by using git itself. Github is fine for hosting but it's not exactly a complete git user interface. On th other hand git log/blame/rev-list commands are built for that. E.g. first commit hash: git rev-list --max-parents=0 HEAD

Can you search github network commit messages?

Upon brief Google and SO search, I couldn't find any info on this. I am looking at this Github repo which hasn't been updated for years, but there are many forks that are still being developed actively. Is there any way to search through commit messages from different forks of this Github repo network?
Beside the Google search already mentioned, another more precise alternative, if that repo is not too big, is to:
list all the forks with this API GET /repos/:owner/:repo/forks
clone them, and do a git grep in each of those local clones.
That way, you are sure to have a complete search.
See also the python frost-nzcr4/find_forks script.
View the Developer Tools while you're loading the repo network page. In the log you'll notice there's two urls - "meta" and "chunk".
Meta is the (json) list of all the users who are in the network and various properties needed to draw the graph, and "chunk" is the commit log from all the users in the graph, which is used to render the tooltips that come up.
Save these outputs and use your favourite text editor / command line tool to search the commit messages.

How to place readme.md on the top of the page

I wrote a readme.md file for my git page. Now I wanna advertise for my program on some forums. I don't want to always update every single forum entry, so I though I just link to my git repo and they people can get the information about my tool just by reading the readme (in the future, all I need to is update this single file).
However, the source files are placed on the top and 99% of the people that will visit my repo won't have a clue about code. Therefore it would attract people more if they just see the readme.md instead of code (which might scare them away "oh I don't get it and it looks to hard to get a fast overview leave").
Is there a way to switch the code section with the readme.md section?
Is there a way to switch the code section with the readme.md section?
There is not for now in a classic GitHub repo.
One workaround would be to limit the number of top elements to a minimum, moving all those folders into a src/ or project/ subfolder.
That would make the code section very short, and the README (just below) that much more visible.
A different repo, as commented by the OP TrudleR, is available with GitHub pages, like a project site using the gh-pages branch.
For that approach, I like to declare that branch as a submodule in the master branch of the same project repo: that way, I can update my project pages while updating the sources of the project itself.
Update August 2016: Simpler GitHub Pages publishing now allows to keep your page files in a subfolder of the same branch (no more gh-pages needed):
Those pages can be in a subfolder of the same branch now.