git config [--global] user.name 设置提交时附带的名字(Set the name attached to all your commits)
1
git config [--global] user.email 设置提交时附带的email(Set the email attached to all your commits)
1
git config --global color.ui auto 设置命令行输出回执的颜色(Set colorzition of command line output for all repos)
1
git config [--global] user.name 获取当前库设置的用户名(Print set name(in current repository or globally))
1
git config [--global] user.email 获取当前库设置的email(Print set email(in current repository or globally))
2、Local Changes(本地操作)
1
git status 查看工作区内的文件修改(List changed files in your working directory)
1
git diff 查看已追踪文件的修改(List changed to tracked files)
1
git add 添加此文件的所有修改在下次提交时(Add all current changed in file to the next commit)
1
git add . 添加本地库中的所有修改在下次提交的时(Add all current changed to the next commit)
1
git mv 修改文件名并添加到下次提交当中(Rename file and add it to next commit)
1
git rm 删除此文件并将此处删除添加到下次提交当中(Delete file and add its deletion to next commit)
1
git commit -a 提交工作区所有文件(Commit all local changes in tracked files)
3、Commit History(提交历史)
1
git log 显示所有的提交日志(Show all commits)
1
git log -p 这个文件的最后一次提交日志(Shwo changes over time for a specific file)
1
git log --author=<committer name> 这个提交者最后一次的提交日志(Show changes over time for a specific committer)
1
git blame <file> 此文件被谁修改了(Who changed what and when in file)
1
git stash 查看临时的文件变动 (Store changes temporarily)
1
git stash pop 删除上一次记录储蓄新的改动记录(Remove and apply changes)
1
git rm --cached <file> 把此文件从过去的提交记录中删除但是保留当前本地的 文件(Remvoe file from previous commits but keep it locally)
4、Branches & Tags(分支和标签)
1
git branch 本地所有的分支列表(List all existing branches)
1
git checkout <branch> 切换分支(Switch HEAD branch)
1
git branch <new branch> 创建新分支(Creat a new branch based on your current HEAD)
1
git branch --track <new-branch><remote-branch> 创建一个新的分支基于一个远程的 分支(Creat a new tracking branch based on a remote branch)
1
git branch -d <branch> 删除一个本地分支(Delete a local branch)
1
git branch origin --delete <branch> 删除一个远程分支(Delete a remote branch)
1
git push <remote> : <old name> 重命名远程分支名(Rename a branch on git push <remote> <new name> remote)git push
1
git tag <tag-name> 给当前提交打一个tag,也可以查看当前标签(Tag the current commit)
5、Update & Publish(更新和提交)
1
git remote -v 查看远程库的地址列表(List all currently configured remotes)
1
git remote show <remote> 查看这个远程库的信息(Show information about a remote)
1
git remote add <remote> <url> 添加新的远程库(Add new remote repository)
1
git remote rename <old-name> <new-name> 重命名远程库(Rename a remote)
1
git fetch <remote> 从远程库更新所有的信息到本地,但是不合并(Download all changes from remote,but don't merge into HEAD)
1
git fetch -p <remote> 从远程库更新所有的信息到本地,但是不合并并清理已删除的远程分 支(Download all changes fromm remote,but don't merge in HEAD and clean up deleted branchs from origin)
1
git pull <remote><branch> 从远程库更新数据并立即合并数据(Download changes and directly merge into HEAD)
1
git push <remote><branch> 将本地数据同步到远程库中(Publish local changes on a remote)
1
git remote add --track <remote-branch><remote><url> 追踪一个远程库(Track a remote repository)
1
git push --tags 同步标签到远程库(Publish your tags
1
git remote show <remote> 显示远程库信息(Show information about a submodule)
6、Merge & Rebase(分支合并和重整数据)
1
git merge <branch> 将其他分支和并到当前分支(Merge branch into your current HEAD)
1
git rebase <branch> 将亲她分支合并到当前分支并按照提交顺序排序(Rebase your current HEAD onto branch)
1
git rebase --abort 终止当前合并(Abort a rebase)
1
git rebase --continue 解决冲突后继续当前合并和重整(Continue a rebase after resolving confilcys)
1
git mergetool 使用配置的合并工具解决冲突(Resolve conflicts using your configured merge tool)