可以使用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显示本地分支关联的远程分支

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐