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

What exactly do we mean by “branch”?

You are correct. We can further split your item 1 by separating “local” and “remote” branch labels: local branches (local labels) are names that start (internally—many front-end command hide this) with refs/heads/, while “remote branches”—which are also called “remote-tracking branches”—start with refs/remotes/ and then have one more path component naming the specific remote before the … Read more

How do I clone a subdirectory only of a Git repository?

git clone –filter from git 2.19 now works on GitHub (tested 2021-01-14, git 2.30.0) This option was added together with an update to the remote protocol, and it truly prevents objects from being downloaded from the server. E.g., to clone only objects required for d1 of this minimal test repository: https://github.com/cirosantilli/test-git-partial-clone I can do: git … Read more

Ignore files that have already been committed to a Git repository [duplicate]

To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm –cached filename To untrack every file that is now in your .gitignore: First commit any outstanding code changes, and then, run this command: git rm -r –cached … Read more