git 常用命令

来源:互联网 发布:齐博cms整站系统v8 编辑:程序博客网 时间:2024/04/27 08:57
git log  -p --stat            ;查看log信息,详细信息
git diff             ;查看当前的修改

git format-patch -1  ;生成基于当前的commit head的一个patch

git format-patch -n commit_no; 生成基于commit_no的n个patch.

git am + patch_file  ;打补丁(patch)
git branch           ;查看分支


git checkout + branch_name ;切换分支
git checkout + commit_no + file_name; 获取指定commit_no的file.
git checkout + branch_name~number + file_name; 获取指定分支后退number个commit的文件。


git reset  HEAD^     ; 撤消前一次的commit, 保留原来的modified.
git reset --hard HEAD^ ; 撤消前一次的commit,不保留modified.


git commit -C HEAD -a --amend ;增补提交, 不会产生新的历史记录


repo format-patch + xxx.xml
-------
build patch sets for each project common to a manifest baseline


Usage: repo format-patch <baseline manifest file name>


Provide the manifest file name documenting the baseline


i.e. repo format-patch eclair-20091115.xml


Will generate the set of patches for each project that is common with
the baseline defined by the file eclair-20091115.xml.


Options:
  -h, --help            show this help message and exit
  -j, --json_summary    output a json summary of differences
  -o OUTPUTDIR, --outputdir=OUTPUTDIR
                        output the results in a specific place