git仓储的命令大全

CREAT(创建)

git init 在当前目录下创建一个本(Create a new local repository)

git clone  ssh://[email protected]/repo.git  在远程库克隆一个本地库(Clone an existing repository)

Configuration(配置)

git config [--global] user.name       设置提交时附带的名字(Set the name attached to all your commits)

git config [--global] user.email  设置提交时附带的email(Set the email attached to all your commits)

git config --global color.ui auto 设置命令行输出回执的颜色(Set colorzition of  command line output for all repos)

git config [--global] user.name 获取当前库设置的用户名(Print set name(in current repository or globally))

git config [--global] user.email 获取当前库设置的email(Print set email(in current repository or  globally))

Local Changes(本地操作)

git status 查看工作区内的文件修改(List changed files in your working directory)

git diff 查看已追踪文件的修改(List changed to tracked files)

git add 添加此文件的所有修改在下次提交时(Add all current changed in file to the next commit)

git add . 添加本地库中的所有修改在下次提交的时(Add all current changed to the next commit)

git mv  修改文件名并添加到下次提交当中(Rename file and add it to next commit)

git rm删除此文件并将此处删除添加到下次提交当中(Delete file and add its deletion to next commit)

git commit -a提交工作区所有文件(Commit all local changes in tracked files)

Commit History(提交历史)

git log 显示所有的提交日志(Show all commits)

git log -p                                       这个文件的最后一次提交日志(Shwo changes over time for a specific file)

git log --author=这个提交者最后一次的提交日志(Show changes over time for a specific committer)

git blame 此文件被谁修改了(Who changed what and when in file)

git stash查看临时的文件变动 (Store changes temporarily)

git stash pop删除上一次记录储蓄新的改动记录(Remove and apply changes)

git rm --cached 把此文件从过去的提交记录中删除但是保留当前本地的文件(Remvoe file from previous commits but keep it locally)

Branches & Tags(分支和标签)

git branch  本地所有的分支列表(List all existing branches)

git checkout 切换分支(Switch HEAD branch)

git branch 创建新分支(Creat a new branch based on your current HEAD)

git branch --track  创建一个新的分支基于一个远程的分支(Creat a new  tracking branch based on a remote branch)

git branch -d                         删除一个本地分支(Delete a local branch)

git branch origin --delete 删除一个远程分支(Delete a remote branch)

git push : 重命名远程分支名(Rename a branch on remote)git push

git push

git tag 给当前提交打一个tag,也可以查看当前标签(Tag the current commit)

Update & Publish(更新和提交)

git remote -v 查看远程库的地址列表(List all currently configured remotes)

git remote show       查看这个远程库的信息(Show information about a remote)

git remote add 添加新的远程库(Add new remote repository)

git remote rename 重命名远程库(Rename a remote)

git fetch 从远程库更新所有的信息到本地,但是不合并(Download all changes from remote,but don't merge into HEAD)

git fetch -p 从远程库更新所有的信息到本地,但是不合并并清理已删除的远程分支(Download all changes fromm remote,but don't merge in HEAD and clean up deleted branchs from origin)

git pull 从远程库更新数据并立即合并数据(Download changes and directly merge into HEAD)

git push 将本地数据同步到远程库中(Publish local changes on a remote)

git remote add --track 追踪一个远程库(Track a remote repository)

git push --tags同步标签到远程库(Publish your tags

git remote show 显示远程库信息(Show information about a submodule)

Merge & Rebase(分支合并和重整数据)

git merge 将其他分支和并到当前分支(Merge branch into your current HEAD)

git rebase 将亲她分支合并到当前分支并按照提交顺序排序(Rebase your current HEAD onto branch)

git rebase --abort 终止当前合并(Abort a rebase)

git rebase --continue 解决冲突后继续当前合并和重整(Continue a rebase after resolving confilcys)

git mergetool使用配置的合并工具解决冲突(Resolve conflicts using your configured merge tool)

git add 手动解决冲突使用编辑器并标记已解决的文件

git rm

Undo(撤销)

git reset --hard HEAD   丢弃所有的本地修改(Discard all local changes in your working directory)

git checkout HEAD 丢弃此文件的本地修改(Discard local changes in a specific file)

git revert  撤销某次的提交内容(Revert a commit by providing a new commit with contrary changes)

git checkout 撤销某次提交的某个文件的内容(Revert a specific file from a previous commit)

重置头指针到过去的某个提交上,版本回退(Reset your HEAD pointer to a previous commit)

git reset --hard   回退到某个版本(Discarding local changes)

git reset 回退到某个版本并保存未追踪的改动

git reset --keep      回退到某个版本并保存未提交的改动

你可能感兴趣的:(git仓储的命令大全)