您的位置:首页 > 其它

工作中常用的git命令

2016-09-22 20:56 155 查看
可以使用git --help 查看常用的git命令

The most commonly used git commands are:

   add        Add file contents to the index

git add . // 当在本地对代码进行修改后,把修改的文件添加到索引库中,

   bisect     Find by binary search the change that introduced a bug

   branch     List, create, or delete branches

git branch -a // 列出所有的分支

git branch // 列出本地分支

git branch -d branch // 删除branch分支

   checkout   Checkout a branch or paths to the working tree

git checkout branch // 切换到branch分支

git checkout -b branch remote/branch // 建立远程分支相关的本地分支

git checkout . // 撤销修改

   clone      Clone a repository into a new directory

   commit     Record changes to the repository

git commit .  // 将修改提交到远程库中

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

git diff // 查看修改

   fetch      Download objects and refs from another repository

   grep       Print lines matching a pattern

   init       Create an empty Git repository or reinitialize an existing one

   log        Show commit logs

git log // 查看提交的修改

   merge      Join two or more development histories together

   mv         Move or rename a file, a directory, or a symlink

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

git pull // 同步本地分支和远程分支

   push       Update remote refs along with associated objects

   rebase     Forward-port local commits to the updated upstream head

   reset      Reset current HEAD to the specified state

git reset --hard commit // 设置head值为commit时的提交

   rm         Remove files from the working tree and from the index

   show       Show various types of objects

git show file // 查看文件具体信息

   status     Show the working tree status

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

git config --list

git config --global user.name "name" // 切换git用户名

git config --global user.email "email" // 切换git邮箱

git config --unset para // 删除配置信息

git branch -vv显示本地分支关联的远程分支
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: