简单的git管理命令

  1. .repo/repo/repo start [branchnewname] –all //创建分支
    创建本地分支(这一步是必须的,否则每次同步都会冲掉本地的提交)

      repo abandon <分支名>删除分支 repo分支
    
    
            .repo/repo/repo status
    

    3.查看当前所有工程分支:
    .repo/repo/repo branches

    repo forall -c git指令 –>为工程里每一个git仓执行相同的git命令//repo forall -c ‘git fetch rk’

    4..repo/repo/repo checkout vr-text//切换到自定义的分支

    git 常用指令
    git branch //查看分支

    git checkout old_cc //切换分支

    git status //查看当前分支修改的文件

    git diff //查看当前分支修改的文件的所有记录

    git add . //在当前分支的目录新创建的文件第一次提交

    git commit -a -m “…” //提交当前分支

    git log //查看提交分支记录

    git checkout . //本地所有修改的。没有的提交的,都返回到原来的状态

    比较当前的代码和某个版本的差别
    比如说某个版本为commit 052052e7e5c3d19ed522a9617ff766b6de69debd
    Author:
    Date: Thu May 24 17:23:41 2018 +0800

                                       resolution of the system camera APP screen display
    
          比较改动的所有文件:git diff 052052e7e5c3d19ed522a9617ff766b6de69debd ---stat
          比较改动的所有代码:git diff 052052e7e5c3d19ed522a9617ff766b6de69debd 
    

回退到某个版本:
1、 git reset –mixed 默认方式 只保留源码,回退commit和index信息,需要git add 和git commit
2、 git reset –soft 回退到某个版本只回退了commit的信息,不会恢复到index file一级。如果还要提交,直接commit即可
3、 git reset –hard 彻底回退到某个版本

猜你喜欢

转载自blog.csdn.net/github_32902495/article/details/80665225