Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page provides a cheat sheet for people to use as a quick reference for the commands used in this document.

...

important -- Items colored in red mean they are important, and should not be ignored.

one time -- Items colored in green are commands to be issued once per machine.

repo once -- Items colored in orange are commands to be issued once per local repository.

...

Setup Commands:

 

Command

Use

git config --global user.name “First Last”

Setup the first and last name that will be used in commits

git config --global user.email “user@domain.com

Setup the email that will be used in commits

git config --global core.editor ${EDITOR}

Setup the default editor for editing messages

git config --global color.ui true

Enable coloring of output from git commands

git config --global http.proxy http://proxy/server:port

Enable a proxy for git commands

 

...

Repository Setup Commands:

 

Command

Use

git clone protocol://path/to/repo.git

Clone a remote repository into a local repository

git clone git@github.com:ACME-Climate/ACME.git

Specific clone command for ACME

 

...

Working with remotes:

 

Command

Use

git remote add remote-name protocol:address/to/repo

Create an alias “remote-name” to communicate with a remote repo at the address specified

git remote remove remote-name

Delete an alias named “remote-name”

git push <remote-name> <local-branch>:<remote-branch>

Push the local branch named <local-branch> (and all associated commit) to the remote named <remote-name>. :<remote-name> will rename the branch on the remote.

git push origin feature:github-username/component/feature

Pushing a local branch named feature to the branch github-username/component/feature on the remote origin

git fetch <remote-name>

Fetch the history from the remote named <remote-name>. Don’t store this history in any local branches

git fetch --all -p

Fetch the history from all remotes, and prune any branches that were deleted on the remote.

git pull <remote-name> <branch-name>

Fetch the history of <branch-name> from the remote named <remote-name> and merge it into the current working branch.

This command is for advanced developers.

 

...