Cheatsheet: GIT Commands
A table of some useful git commands.
Command | Description |
---|---|
git init | Create a new local repository |
git rm -rf .git | Undo git init |
git add filename git add . | Add one or more files to staging (index) |
git status | List the files you’ve changed and those you still need to add or commit |
git commit -m message | Commit changes to head (but not yet to the remote repository) |
git log | Show commit history. CommitId is the leading characters of the changeset ID, up to 10. |
git checkout branch | Checkout an exisitng branch |
git remote add origin server | Adds remote server so that project can be pushed. |
git push add origin master | Push the branch to your remote master repository |
git pull | Fetch and merge changes on the remote server to your working directory |
git revert –no-commit commitID ..HEAD | Reverts the head to the specified commitID. All changes would not be lost, but will exist as unsaved changes in project. |
Other useful GIT Links:
How to push Cloud9 project to GitHub: http://lepidllama.net/blog/how-to-push-an-existing-cloud9-project-to-github/
Great GIT tutorials: https://www.atlassian.com/git/tutorials/what-is-version-control