Which commit has this blob?

Both of the following scripts take the blob’s SHA1 as the first argument, and after it, optionally, any arguments that git log will understand. E.g. –all to search in all branches instead of just the current one, or -g to search in the reflog, or whatever else you fancy. Here it is as a shell … Read more

How to list branches that contain a given commit?

From the git-branch manual page: git branch –contains <commit> Only list branches which contain the specified commit (HEAD if not specified). Implies –list. git branch -r –contains <commit> Lists remote tracking branches as well (as mentioned in user3941992‘s answer below) that is “local branches that have a direct relationship to a remote branch”. As noted … Read more

Definition of “downstream” and “upstream”

In terms of source control, you’re downstream when you copy (clone, checkout, etc) from a repository. Information flowed “downstream” to you. When you make changes, you usually want to send them back “upstream” so they make it into that repository so that everyone pulling from the same source is working with all the same changes. … Read more

Git for beginners: The definitive practical guide

How do you create a new project/repository? A git repository is simply a directory containing a special .git directory. This is different from “centralised” version-control systems (like subversion), where a “repository” is hosted on a remote server, which you checkout into a “working copy” directory. With git, your working copy is the repository. Simply run … Read more

Do I commit the package-lock.json file created by npm 5?

Yes, package-lock.json is intended to be checked into source control. If you’re using npm 5+, you may see this notice on the command line: created a lockfile as package-lock.json. You should commit this file. According to npm help package-lock.json: package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. … Read more