static void

Git

Files and (local) commits

Files are staged (tracked by git) before they are committed.

Create labels/tags with git tag -a tagName -m 'This is labelled tagName'
Add the commit checksum (or the first unique part of it) to tag a specific commit

Remotes (central servers)

A remote is the central source control server (equivalent to Subversion or TFS).

git clone https://github.com/xxx creates a local repository from the origin remote

git remote -v shows the remote(s) with url.

Cloned files are automatically tracked (no need to git add file).

Forked repos

When you fork, you want a link to the origin of the fork- the "upstream".

git remote add upstream https://original-repo/

To update with latest changes:

Get Latest

git pull does a git fetch origin and git merge to get the latest from the origin.

NB: fetch just gets the data into the .git repository (not files), merge changes the file contents.

Check in

git push {remotename} {branchname}- pushes commits from branch to remote e.g. git push origin master.

A push is like a branch merge, but you can only do fast-forward merges. The more common workflow is to do a pull request (not actually a command, but github has a great UI to do it)

Branches

Unlike Subversion/TFS, you don't branch to a new folder with a different set of files. It's the same folder as the trunk ("master").

Workflow

There are several common workflows:

Centralized

This is the closest to centralized subversion/TFS source control, is simple and works

Feature branches

Tricks