Git

Configuration

$ git --version

$ git config --global user.name "Username"

$ git config --global user.email "example@email.com"

$ git config --list

Sample workflow

mkdir for your new project

create some files in there, get started, etc.
$ git init

$ git status (should be empty)

$ git add animals.txt wow.html

$ git status (Now git is watching these files for changes!)

$ git commit -am "first commit" (now you've saved a snapshot of the directory.
Note: it will only commit changes in the files you're watching.)

$ git status (should be clean)

$ git push

$ git log

Keeping track of renaming a file

$ git mv file.md better_name.md

$ git commit -am "Given a more appropriate name to file.md"

$ git push origin master

Forks and Pull Requests

$ git clone https://github.com/[yourUsername]/phaser.git
$ cd phaser
$ git remote -v
origin	https://github.com/[yourUsername]/phaser.git (fetch)
origin	https://github.com/[yourUsername]/phaser.git (push)
$ git remote add upstream https://github.com/photonstorm/phaser.git
$ git remote -v
origin	https://github.com/[yourUsername]/phaser.git (fetch)
origin	https://github.com/[yourUsername]/phaser.git (push)
upstream	https://github.com/photonstorm/phaser.git (fetch)
upstream	https://github.com/photonstorm/phaser.git (push)
$ git fetch upstream
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Total 15 (delta 8), reused 8 (delta 8), pack-reused 7
Unpacking objects: 100% (15/15), done.
From https://github.com/photonstorm/phaser
 * [new branch]          arcade-physics-2 -> upstream/arcade-physics-2
 * [new branch]          master           -> upstream/master
 * [new branch]          pathfollower     -> upstream/pathfollower
 * [new branch]          render-pass      -> upstream/render-pass
 * [new branch]          rendersplit      -> upstream/rendersplit
 * [new branch]          scalemanager     -> upstream/scalemanager
 * [new branch]          webgl-tilemap    -> upstream/webgl-tilemap
 * [new tag]             3.12.0-beta3     -> 3.12.0-beta3
 * [new tag]             v3.10.0          -> v3.10.0
 * [new tag]             v3.50.0          -> v3.50.0
 * [new tag]             v3.50.0-beta.1   -> v3.50.0-beta.1
 ...
 * [new tag]             v3.50.0-beta.8   -> v3.50.0-beta.8
 * [new tag]             v3.50.0-beta.9   -> v3.50.0-beta.9
 * [new tag]             v3.50.1          -> v3.50.1
 * [new tag]             v3.51.0          -> v3.51.0
 * [new tag]             v3.52.0          -> v3.52.0
 * [new tag]             v3.53.0          -> v3.53.0
 * [new tag]             v3.53.1          -> v3.53.1
 * [new tag]             v3.54.0          -> v3.54.0
$ git checkout master
Already on 'master'
Your branch is up to date with 'origin/master'.
$ git merge upstream/master
Already up to date.
$ git commit -am "blah blah blah"
$ git push

...finally, from GitHub:

Branch

git status On branch master

git branch feature/add-helper-funcs fix/add-missing-arguments fix/remove-double-parentesis * master refine-test-class

git checkout -b "test/branch-something" Switched to a new branch 'test/branch-something'

git push --set-upstream origin test/branch-something

git push -u origin test/branch-something


git switch master

Or:
git checkout master