-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
git status - view staged, unstaged, and untracked files | ||
git commit - save staged snapshot to the git history | ||
|
||
git log - view history | ||
git log --author=<pattern> | ||
- search for author | ||
git log --grep=<pattern> | ||
- search for commit message | ||
|
||
git log --oneline | ||
git log <file> | ||
git log --graph --decorate | ||
|
||
git checkout <branch|commit|file> | ||
- Checking out a commit will not allow you to save any of the changes | ||
- Checking out a file will put the checked out version of the file in the working | ||
directory which can be committed | ||
|
||
git revert <commit> | ||
- Adds a negative commit to the history | ||
- Can be undone | ||
|
||
git revert HEAD | ||
- undoes the last commit | ||
|
||
git reset | ||
- Resets the staging area which is different from revert | ||
- Don't do this for published commits otherwise there will be a hole in the git | ||
history | ||
|
||
- Reset can be used to turn many local commits to a single commit | ||
|
||
git reset | ||
- Unstage all changes | ||
|
||
git reset <HEAD|commit|file> | ||
- Unstages a file but the changes are still there | ||
|
||
git reset --hard <HEAD|commit|file> | ||
- Reset the working directory to the last commit | ||
|
||
git clean | ||
- Deletes untracked files | ||
|
||
git commit --amend | ||
- Combines staged changes with the previous commit | ||
- This alters the last commit without changing it | ||
- Don't do this on published commits | ||
|
||
git commit --amend --no-edit | ||
- Ammend and don't change the commit message |