How can I search Github code for a keyword? - github

I'm a bit flummoxed that I can't find how to do this simple search on Github.
I want to search the code of one of my own repos for a keyword. Surely this is possible?
There is a global search feature but that doesn't seem to do it eg index is about 17 days old and doesn't contain actual code (only results from readme)
Any thoughts? If not maybe there is a 3rd party tool? I'm looking for something that works directly off Github
Cheers

The git grep command has a few advantages over normal searching commands like grep and ack. The first is that it’s really fast, the second is that you can search through any tree in Git, not just the working directory. As we saw in the above example, we looked for terms in an older version of the Git source code, not the version that was currently checked out.
This could be what you're searching for.

Related

Use versions w/ github remote repositories (in this case w/ platformio)

This might be a basic github question, but I'm having trouble finding the right keywords to google because I don't know the terminology. Apologies and thanks in advance.
I've noticed with library dependencies in library.json, under "dependencies", there is often a github remote repo link with a version number after the #
For example
https://github.com/codewitch-honey-crisis/htcw_ili9341.git#1.0.0"
What is that exactly after the #? A branch? A release?
More importantly, how do I make my github repo expose these. Like, I want to make a 1.0.0 one now for htcw_ili9341.git but later I may want to make 1.0.1
Using the github website, and/or the command line, how do I go about this?
It would be really helpful if you explained as you went as well.
So you know where I'm coming from with this, I've been using github for awhile but only for the most basic things, and driving it all through VS Code for the most part, sometimes resorting to the web interface and only occasionally dropping to the command line, which I've done a handful of times to resolve merge conflicts. I'm not an expert, but not completely new to it either.
anything after # is never posted to the server. It's basically a comment in this specific instance.

Single-file diff between two commits

In github, is it possible to show the diff of a single file between two commits?
One can readily diff two commits, and it is possible to link to the anchor for a specific file in those two commits, but all files are included in that view. For example, https://github.com/adamginsburg/APEX_CMZ_H2CO/compare/a94a962db51e0f4e73ec3ba4170a0ca8269548da...adamginsburg:master#diff-22
I would like a similar view, but without the other files.
(I know how to do this on the command line with git, but I want to share this link with collaborators, so the command line approach is not relevant for this question)
I think your question can be consider a duplicate of this one :
How can I generate a diff for a single file between two branches in github
Unfortunately, the accepted answer doens't answer your expected behavior.
I really tried to exclude the other files without success, and since there not seems to have other means to filter it out but html anchor pointer, I guess what you already have is what best available with Github to pin point the change you want to talk about with your peers.
I can recommend you to use Vscode with the Git History, I know is not the same as having in Github but it allows you to see the changes of the code according to an specific file or the entire project, comparing with the actual code, see all the changes of specific file through the commits, I work with this tool and this is helpful for me, hopefully it will be helpful for you.
Git History Example Usage
You can use the GitHub File Diff extension available for Chrome and Firefox.
Disclaimer: I made this extension.

Create package of latest revisions in Github

I have looked for the 'patch' system but I don't think this is what I want. I've also done a little research but I am not sure how I should ask the question.
I want to make a package with only the modified files of the latest revisions on Github.
I am wondering if there's a little application or some sort of commands I could use instead of going into each revisions and track files by files which have been modified to then pack them all into a zip/tar.gz file.
Reason we want to do this is obviously update a lot of websites using an older version, without having the trouble to go look up for each files that we're modified and pack them 'by hand'
Thanks.
Perhaps this might help? Exporting / Archiving changed files only in Git
Looks like a similar issue if I understand what you are trying to do!

How do I post code to GitHub?

I've looked everywhere but I can't find any way to post code to GitHub. I tried making a repository but then it tells me I have to download a command prompt thing?
Why can't I just post code directly to it? Is there any other way?
If you are simply looking for a way to put some code online, then you can use another feature of that site calles "gists".
If you are on a mac, then there is another app you can use (made by the GitHub guys).
But the most relevant piece of software is what you refer to as " command prompt thing", which is a version control application with a relatively steep learning curve called GIT.
On a final note you might be misunderstanding what GitHub is useful for and might be better off looking at something a bit less complicated. If you are willing to explain exactly what you are looking for then i'm sure the StackOverflow community will be willing to help you :)
You may use github's gist.
Although, the main point of using github is to share git repositories.
While GitHub has recently added limited support for editing files through the web interface, it's intended as hosting for software projects using the Git source control software. The most-used interface is the command-line git tool, though there are graphical interfaces such as TortoiseGit as well as Git components for many IDEs.
If all you're looking for is a place to put small code fragments for sending to others (like a pastebin), then you probably want Gists instead: http://gist.github.com/
Github is a code hosting site for Git.
The "command prompt thingy" is likely Git. If you don't use Git, it's unlikely you want Github either.
Luckily there are graphical Git front ends such as SmartGit.

What is this version-tagging format for/from: $Revision: 3.2.1 $

I've seen it everywhere. In documentation, web sites, help screens, you name it.
Why?
Should I use it too?
How?
The tag is probably from CVS and represents the version of that file in CVS. The developer inserts $Revision$ in his code. When it's committed, CVS expands this to $Revision: 1.2.3$. In my opinion, you definitely shouldn't use it or its friends (such as $Id$), at least in normal source code.
If you have a more modern source control system (SVN, Mercurial, git, monotone) which has a single version number for the whole tree, then keeping a file somewhere in your build that contains that number isn't a bad thing - it lets you do things such as in the bottom right of this page, where right now it says "svn revision: 3772".
But if you have something like CVS, where each file has its own separate version numbers, you end up with $Revision$ (or $Id$ or whatever) in each file. Over time, this causes confusion (people quoting version numbers that only refer to one file, for example) and leads to merge errors where there might otherwise have been a clean merge (remote version has a different version of that line than your local version, merger trips up).
Plus, anything programmatically and automatically changing your source code should be viewed with suspicion.
That is probably an expanded version of '$Id$', which I think has its origins with the RCS version control system, and has been inherited or implemented in many others, not least CVS and SVN.
Basically, you stick '$Id$' into your source code somewhere, and the version control system expands it to an identity string containing the current revision on every checkout.
Then, when looking at source code you can remind yourself which revision or branch the source code has come from.
Personally I do not find it that useful.
Here is the CVS documentation for keyword substitution: http://ximbiot.com/cvs/manual/cvs-1.11.6/cvs_12.html
Note that $Id$ is one of many such strings that can be used.
Why?
It's an attempt to answer the question "Which version of the source code matches the binaries shipped to a customer?" How it works others have commented on.
Should I use it too?
How?
Do you need it? How often have you or your developers asked that question? How often have you had difficulty answering it? If you already have tags/branches like release-1.0, release-1.1 etc., then you most likely don't need it.