git merge用法_返璞归真,重回GIT命令

8264f09ab265d483800c4f2ab7df6930.png

git常用命令完整用法

是不是厌倦了sourcetree老是卡死,是不是厌倦了小乌龟来来回回在多个目录下切换,返璞归真,黑框+命令回到git童真。下面列举了常用GIT命令的完整用法,后续整理全套GIT完整用法API。

一、init(初始化)

[Name]

git init: Create an empty Git repository or reinitialize an existing one

[Syntax]

git init

[-q | --quiet] [--bare] [--template=]

[--separate-git-dir ]

[--shared[=]] [directory]

二、clone(克隆)

[Name]

git clone: Clone a repository into a new directory

[Syntax]

git clone

[--template=]

[-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]

[-o ] [-b ] [-u ] [--reference ]

[--dissociate] [--separate-git-dir ]

[--depth ] [--[no-]single-branch] [--no-tags]

[--recurse-submodules[=]] [--[no-]shallow-submodules]

[--jobs ] [--] []

三、status(状态)

[Name]

git status: git-status - Show the working tree status

[Syntax]

git status […​] [--] […​]

四、diff(差异化)

[Name]

git diff: Show changes between commits, commit and working tree, etc

[Syntax]

it diff [] [] [--] […​]

git diff [] --cached [] [--] […​]

git diff [] [--] […​]

git diff []

git diff [] --no-index [--]

五、add(追踪)

[Name]

git add: Add file contents to the index

[Syntax]

git add

[--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]

[--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]

[--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize]

[--chmod=(+|-)x] [--] […​]

六、mv(命名)

[Name]

git-mv: Move or rename a file, a directory, or a symlink

[Syntax]

git mv …​ …​

七、rm(删除)

[Name]

git-rm: Remove files from the working tree and from the index

[Syntax]

git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] …​

八、commit(提交)

[Name]

git-commit: Record changes to the repository

[Syntax]

git commit

[-a | --interactive | --patch] [-s] [-v] [-u] [--amend]

[--dry-run] [(-c | -C | --fixup | --squash) ]

[-F | -m ] [--reset-author] [--allow-empty]

[--allow-empty-message] [--no-verify] [-e] [--author=]

[--date=] [--cleanup=] [--[no-]status]

[-i | -o] [-S[]] [--] […​]

九、log(日志)

[Name]

git-log: Show commit logs

git-blame: Show what revision and author last modified each line of a file

[Syntax]

git log [] [] [[--] …​]

git blame

[-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental]

[-L ] [-S ] [-M] [-C] [-C] [-C] [--since=]

[--progress] [--abbrev=] [ | --contents | --reverse ..]

[--]

十、branch(分支)

[Name]

git-branch: List, create, or delete branches

[Syntax]

git branch

[--color[=] | --no-color] [-r | -a]

[--list] [-v [--abbrev= | --no-abbrev]]

[--column[=] | --no-column] [--sort=]

[(--merged | --no-merged) []]

[--contains []]

[--points-at ] [--format=] […​]

git branch [--track | --no-track] [-f] []

git branch (--set-upstream-to= | -u ) []

git branch --unset-upstream []

git branch (-m | -M) []

git branch (-c | -C) []

git branch (-d | -D) [-r] …​

git branch --edit-description []

十一、tag(标签)

[Name]

git tag: Create, list, delete or verify a tag object signed with GPG

[Syntax]

git tag [-a | -s | -u ] [-f] [-m | -F ] [-e]

[ | ]

git tag -d …​

git tag [-n[]] -l [--contains ] [--no-contains ]

[--points-at ] [--column[=] | --no-column]

[--create-reflog] [--sort=] [--format=]

[--[no-]merged []] […​]

git tag -v [--format=] …​

十二、merge(合并)

[Name]

git merge: Join two or more development histories together

[Syntax]

git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]

[-s ] [-X ] [-S[]]

[--[no-]allow-unrelated-histories]

[--[no-]rerere-autoupdate] [-m ] [-F ] […​]

git merge --abort

git merge --continue

十三、rebase(衍合)

[Name]

git rebase : Reapply commits on top of another base tip

[Syntax]

git rebase [-i | --interactive] [] [--exec ] [--onto ]

[ []]

git rebase [-i | --interactive] [] [--exec ] [--onto ]

--root []

git rebase --continue | --skip | --abort | --quit | --edit-todo | --show-current-patch

十四、revert(撤销)

[Name]

git revert : Revert some existing commits

[Syntax]

git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[]] …​

git revert --continue

git revert --quit

git revert --abort

十五、checkout(switch+restore)

[Name]

git checkout: Switch branches or restore working tree files

[Syntax]

git checkout [-q] [-f] [-m] []

git checkout [-q] [-f] [-m] --detach []

git checkout [-q] [-f] [-m] [--detach]

git checkout [-q] [-f] [-m] [[-b|-B|--orphan] ] []

git checkout [-f|--ours|--theirs|-m|--conflict=

git checkout [] [--] …​

git checkout (-p|--patch) [] [--] […​]

十六、reset(重置HEAD)

[Name]

git reset: Reset current HEAD to the specified state

[Syntax]

git reset [-q] [] [--] …​

git reset (--patch | -p) [] [--] […​]

git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] []

十七、revert(重置commits)

[Name]

git revert : Revert some existing commits

[Syntax]

git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[]] …​

git revert --continue

git revert --quit

git revert --abort

十八、fetch(获取)

[Name]

git fetch: Download objects and refs from another repository

[Syntax]

git fetch [] [ […​]]

git fetch []

git fetch --multiple [] [( | )…​]

git fetch --all []

十九、pull(拉取)

[Name]

git pull: Fetch from and integrate with another repository or a local branch

[Syntax]

git pull [] [ […​]]

二十、push(推送)

[Name]

git push: Update remote refs along with associated objects

[Syntax]

git push [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=]

[--repo=] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]

[-u | --set-upstream] [-o | --push-option=]

[--[no-]signed|--signed=(true|false|if-asked)]

[--force-with-lease[=[:]]]

[--no-verify] [ […​]]

二十一、remote(服务器仓库)

[Name]

git remote: Manage set of tracked repositories

[Syntax]

git remote [-v | --verbose]

git remote add [-t ] [-m ] [-f] [--[no-]tags] [--mirror=]

git remote rename

git remote remove

git remote set-head (-a | --auto | -d | --delete | )

git remote set-branches [--add] …​

git remote get-url [--push] [--all]

git remote set-url [--push] []

git remote set-url --add [--push]

git remote set-url --delete [--push]

git remote [-v | --verbose] show [-n] …​

git remote prune [-n | --dry-run] …​

git remote [-v | --verbose] update [-p | --prune] [( | )…​]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值