Git Command Review
References
Commands
- git clone
git clone theRepository
(also see here) this will clone the repository starting in a current directory, in a subdirectory named after the project. You can add one more parameter to specify a different name.
- git status
- Shows the current status of files/directories.
- git add
- Adds a new or modified file to the staging area. Can be used to add multiple files too.
- git commit
- Creates a commit from the staged changes. Use the
-m
flag to leave a message right there. You can use the --amend
flag to amend to the previous commit instead.
- git diff
- Shows the difference between two versions of a file. Do
git diff --staged
to see the modifications that are staged.
.gitignore
- A file that you can have in your project’s root, indicating files and folders that should not be tracked by git.
- git log
- Shows you a listing of past commits. Many useful options.
- git reset
- “Resets” your staging area, typically by unstaging a file.