git 和 repo 常用命令

一、git

1、回退到某个节点

  git reset --hard f39043d1c0cd1cda45a4569556758d0c00bf329a   

2、查看提交记录

  git log

  git log -p  查看更改内容

  git show 节点号, 查看某个节点的更改内容,如git show f39043d1c0cd1cda45a456

 3、提交代码

  git pull ----------同步代码(查看是否与库上代码冲突)

  git add ./  ----------添加当前所有文件

  git rm 文件路径 ------------删除特定文件

  git status -----------查看当前工程状态

  git commit ---------提交代码 git commit --amend  -----追加提交

二、repo

1、查看repo下所有git工程更改文件列表

  repo status

2、repo forall -c

  遍历所有的git仓库,并在每个仓库执行-c所指定的命令(被执行的命令不限于git命令,而是任何被系统支持的命令,比如:ls 、 pwd 、cp 等 

 3、repo拉新分支(例如创建分支new_branch)

1)repo start  new_branch --all  (本地创建分支)

2)repo forall -c git push 远程分支名  new_branch

3)cd .repo/manifests
4)vi default.xml
        <default revision="new_branch"
         remote="roobo-ipc"
         sync-j="4" />
5)git add default.xml
6)git commit -m "upload new_branch"
7)git push origin HEAD:wet

  

原文地址:https://www.cnblogs.com/jly594761082/p/10501392.html