Files: File InformationDisplays the list of all files that are submitted until a certain time.
gitls-tree--name-only-r<commit-ish>
Displays all files modified in a certain submission.
gitdiff-tree--no-commit-id--name-only-r<commit-ish>
Displays all submitted modifications to a file.
gitlog--follow-p--<file_path>
Manipulation: operations on submission
Apply: Commit confirmation or application
Use cherry-pick to apply a cross-branch commit of a branch to another branch.
gitcheckout<branch-name>&&gitcherry-pick<commit-ish>
Ignore the Staging region during submission
gitcommit-am<commitmessage>
Ignore a file during submission
gitupdate-index--assume-unchangedChangelog;gitcommit-a;gitupdate-index--no-assume-unchangedChangelog
Revoking a deliberate ignoring
gitupdate-index--no-assume-unchanged<file_name>
Mark a submission as a Fixup for a previous submission
gitcommit--fixup<SHA-1>
Reset: resets the HEAD of the current branch to the status at a certain submission.
Reset HEAD to submit for the first time
gitupdate-ref-dHEAD
It is recommended that you only perform operations on the private branch after a Commit is discarded. Note: As with the previous operation, resetting does not change the current file status. Git will automatically list the Changes made to the current file and the Commit as Changes.
gitreset<commit-ish>
Undo & Revert: Undo and restore a Commit
Undo a submitter by creating a new submitter.
gitrevert<commit-ish>
Restore the status of a file to a Commit.
gitcheckout<commit-ish>--<file_path>
Update: modify a Commit.
Modify the information submitted last time
gitcommit-v--amend
Modify submitted author information
gitcommit--amend--author='AuthorName<email@address.com>'
After the global configuration changes, modify the author information.
gitcommit--amend--reset-author--no-edit
Modify the submission content of the previous Commit but do not modify the submission information
gitadd--all&&gitcommit--amend--no-edit
Branch: Branch
Info: View information
Obtain the current branch name
gitrev-parse--abbrev-refHEAD
Tag
List the most common labels on the current Branch
gitdescribe--tags--abbrev=0
List: branch Enumeration
Obtain all local and remote branches
gitbranch-a
Show only remote branches
gitbranch-r
Searches for all associated branches based on the Hash of a Commit.
Gitbranch-a -- contains <commit-ish> or gitbranch -- contains <commit-ish>
Changes: view Changes on a branch
View all modifications made in the past two weeks
Gitlog -- no-merges -- raw -- since = '2weeksago 'or gitwhatchanged -- since = '2weeksago'
Merger: View merging status
Traces the upstream branches of a branch.
gitbranch-uorigin/mybranch
List all branches and Their Upstream and last commit
gitbranch-vv
List all branches that have been merged into the Master
gitbranch--mergedmaster
Manipulation: Operation
Checkout: Detection and branch Switching
Quickly switch to the previous Branch
gitcheckout-
Checks out a branch without historical records
gitcheckout--orphan<branch_name>
Remove: Remove Branch
Delete local branch
gitbranch-d<local_branchname>
Delete remote Branch
Gitpushorigin -- delete <remote_branchname> or gitpushorigin: <remote_branchname>
Remove all branches that have been merged into the Master
gitbranch--mergedmaster|grep-v'^/*'|xargs-n1gitbranch-d
Remove all remote branches that have been deleted from the remote end.
Gitfetch-p or gitremotepruneorigin
Update: Information Update
Modify the current branch name
Gitbranch-m <new-branch-name> or gitbranch-m [<old-branch-name>] <new-branch-name>
Rchive: Packaging
Package Master branches
gitarchivemaster--format=zip--output=master.zip
Pack history records, including branch content, into a file
gitbundlecreate<file><branch-name>
Import from a Bundle
gitclonerepo.bundle<repo-dir>-b<branch-name>
Merge: Merge
Pull & Push: Remote branch merge operation
Use pull to overwrite local content
gitfetch--all&&gitreset--hardorigin/master
Pull a Pull request to the local branch based on the Pull ID
gitfetchoriginpull/<id>/head:<branch-name>
Or
gitpulloriginpull/<id>/head:<branch-name>
Rebase: change the base
Use the variable base to perform operations in Pull.
gitconfig--globalbranch.autosetuprebasealways
Change a feature branch to the master and then merge it into the master.
gitcheckoutfeature&&gitrebase@{-1}&&gitcheckout@{-2}&&gitmerge@{-1}
Automatically Stash all changes before changing the base
gitrebase--autostash
Automatic fixup submission and normal submission merging using the variable base
gitrebase-i--autosquash
Merge the first two commits using ReBase
gitrebase--interactiveHEAD~2
Diff & Conflict: Difference and Conflict
Info: View information
List all conflicting files
gitdiff--name-only--diff-filter=U
Open all conflicting files in the editor
gitdiff--name-only|uniq|xargs$EDITOR
Workflow: Workflow
SubModules: submodule
Info: View information
Manipulation: Operation
Add a Project to the Repo using the SubTree Method
gitsubtreeadd--prefix=<directory_name>/<project_name>--squashgit@github.com:<username>/<project_name>.gitmaster
Update all sub-modules
gitsubmoduleforeachgitpull
Work Tree
Manipulation: Operation
Create a new Working Tree from a repository
gitworktreeadd-b<branch-name><path><start-point>
Create a new Working Tree from the HEAD status
gitworktreeadd--detach<path>HEAD
From: http:// OS .51cto.com/art/201608/515536.htm
Address: http://www.linuxprobe.com/some-git-tips.html