Common Git terms
Term | Idea |
repository (aka repo) | project folder |
local repository (aka local) | project folder on a personal computer |
remote repository (aka remote) | project folder on the Internet (a server, perhaps?) |
staging | a selection of files from the project folder |
committing | confirming the selection of files as a change to the project |
pushing | uploading the confirmations to the project folder on the Internet |
cloning | copying a project folder from the Internet to one's computer |
forking | copying someone else's project from the Internet onto one's own account |
branching | creating a parallel version of a project (which can later merge back) |
checkout | setting a branch as the current working branch |
merging | combining a version with another version of a project |
Common Git commands
Type git
plus any of the following:
Command | Idea |
init | creates or initializes a new local repository |
add -A | adds all the changes to the Git repository to "staging" |
commit -m "message" | updates the local repository with all the changes previously added to "staging" (tagged with a message summarizing the changes made) |
remote add origin [repourl] | connects the local repository with a remote repository (usually on GitHub.com) |
push [origin] [branch] | uploads the most recently committed changes |
clone [repourl] | downloads a remote repository to one's own computer |
checkout [branchname] | switches to a branch in the local repository (assuming it exists) |
checkout -b [newbranchname] | creates a new branch in the local repository |
branch -a | displays a list of all branches |
status | displays the current status of the local repository, i.e.: |
pull [branch] | retrieves the latest changes of a working version from the remote to the local |
diff | displays a list of code changes since the last add |
Typical workflow
$ git add -A
$ git commit -m "adding all files"
$ git push origin development
$ git pull support/newbranch
$ git checkout -b support/newbranch devlopment
$ git branch -a
$ git status
$ git diff