In the actual use of Git development process, some common instructions note
The basic concept
English | Chinese |
---|---|
working tree |
The workspace |
stage/index |
The staging area |
origin |
The remote source, |
tag |
The label |
mainline |
The main line |
git-commit
Record changes to the repository
Commit changes to the warehouse
The command | describe |
---|---|
-n, --no-verify |
This option avoids executionpre-commit 和 commit-msg hook |
git-tag
Create, list, delete or verify a tag object signed with GPG
Create, list, or delete labels
The command | describe |
---|---|
git tag -a [tagname] -m [msg] |
Create labels and add information |
git tag -l |
List local label |
git tag -d [tagname] |
Deleting a Local Label |
git push --tags |
Push all local labels to the remote |
git push origin :refs/tags/[tagname] |
Deleting a Remote Label |
git-stash
Stash the changes in a dirty working directory away
Hide all temporary and non-temporary changes in the workspace
The command | describe |
---|---|
git stash |
Rapid concealment |
Git stash push [-m <message>] [--] [< pathSpec >... |
Add remarks and specify a path |
git stash list |
Present it as a list |
git stash pop [<stash>] |
Apply the changes to the top of the stack locally and remove the top of the stack |
git stash apply [<stash>] |
Apply changes to the top of the stack locally |
git stash clear |
Deleting a Remote Label |
git-clean
Remove untracked files from the working tree
Delete untraced files from the workspace
The command | describe |
---|---|
git clean [-d] [-f] |
Delete the instruction |
-d |
Recursively delete directories and all directories and files contained within directories |
-f, --force |
If this option is not added,git clean You do not have permission to delete files and directories |
git-revert
Revert some existing commits
Undo existing commits
Undo an existing commit by creating a new commit
The command | describe |
---|---|
git revert [commit] |
Undo a commit that already exists |
-n, --no-commit |
Instead of creating a new commit, the undone code is added directly to the workspace and staging area |
git revert [start-commit].. [end-commit]
Undo the commit of a specified interval, open before closing, excluding [start-commit], including [end-commit]
git revert -m 1 [merge-commit]
--mainline parent-number
To undo merge, run git show [merge-commit]
Reference documentation
- Git Documentation
- Git use tutorial: the most detailed, the most fool, the most shallow, real hand teach!
- Give your Git a different identity
- DrVanScott/git-clone-init